AD4BP

Write a programe for decide entered no is odd/even.

Input:-
#include< stdio.h >
#include< conio.h >
void main( )
{
int n,a;
clrscr( );
printf("Enter Number:");
scanf("%d",&n);
a=n%2;
if(a==0)
{
printf("%d is Even number",n);
}
else
{
printf("%d is Odd number",n);
}
getch( );
}

Output:-
Enter Number:95
95 is Odd number


Write a programe convert temperature Fahrenheit into calcious.

Input:-
#include< stdio.h >
#include< conio.h >
void main( )
{
float c,f;
clrscr( );
printf("Enter temperature in Fahrenheit: ");
scanf("%f",&f);
c=(f-32)/1.8;
printf("\nTemperature in Calcious=%2.2f",c);
getch( );
}

Output:-
Enter temperature in Fahrenheit: 98
Temperature in Calcious=36.67


Write a programe convert temperature celcious into fahrenheit.

Input:-
#include< stdio.h >
#include< conio.h >
void main( )
{
float c,f;
clrscr( );
printf("Enter temperature in Celcious: ");
scanf("%f",&c);
f=1.8*c+32;
printf("\nTemperature in Fahrenheit=%2.2f",f);
getch( );
}

Output:-
Enter temperature in Celcious: 25
Temperature in Fahrenheit=77.00


Write a programe swap two number with using third variable .

Input:-
#include< stdio.h >
#include< conio.h >
void main( )
{
int a,b,c;
clrscr( );
printf("Enter value of a: ");
scanf("%d",&a);
printf("Enter value of b: ");
scanf("%d",&b);
c=a;
a=b;
b=c;
printf("\nValue of a:%d",a);
printf("\nValue of b:%d",b);
getch( );
}

Output:-
Enter value of a: 5
Enter value of b: 9
Value of a:9
Value of b:5


Write a programe swap two number without using third variable .

Input:-

#include< stdio.h >
#include< conio.h >
void main( )
{
int a,b;
clrscr( );
printf("Enter value of a: ");
scanf("%d",&a);
printf("Enter value of b: ");
scanf("%d",&b);
a=b-a;
b=b-a;
a=a+b;
printf("\nValue of a:%d",a);
printf("\nValue of b:%d",b);
getch( );
}

Output:-
Enter value of a: 25
Enter value of b: 36
Value of a:36
Value of b:25


Write a programe for calculate simple interest.

#include< stdio.h >
#include< conio.h >
void main( )
{
int p,n;
float r,i;
clrscr( );
printf("Enter Value of p: ");
scanf("%d",&p);
printf("Enter Value of n: ");
scanf("%d",&n);
printf("Enter Value of r: ");
scanf("%f",&r);
i=p*r*n/100;
printf("Interest=%5.2f",i);
getch( );
}

Output:-
Enter Value of p: 10000
Enter Value of n: 3
Enter Value of r: 10.00
Interest=3000.00


Write a programe for find diagonal of rectangle by length & width.

#include< stdio.h >
#include< conio.h >
#include< math.h >
void main( )
{
int a,b;
float c;
clrscr( );
printf("Enter length of rectangle:");
scanf("%d",&a);
printf("Enter width of rectangle:");
scanf("%d",&b);
c=sqrt(a*a+b*b);
printf("Daigonal of ractangle=%f",c);
getch( );
}

Output:-
Enter length of rectangle:4
Enter width of rectangle:3
Daigonal of ractangle=5.000000


Write a programe for make simple calculator by using switch case

#include< stdio.h >
#include< conio.h >
void main()
{

int a,b,c;
char op;
float d;
clrscr();
j:
printf("Enter 1st no:");
scanf("%d",&a);

printf("Enter 2st no:");
scanf("%d",&b);

fflush(stdin);

printf("Enter Operater:");
scanf("%c",&op);

switch(op)
{
case '+':
{
c=a+b;
printf("Answer:%d",c);
break;
}

case '-':
{
c=a-b;
printf("Answer:%d",c);
break;
}

case '*':
{
c=a*b;
printf("Answer:%d",c);
break;
}

case '/':
{
d=(float)a/(float)b;
printf("Answer:%f",d);
break;
}

case '%':
{
c=a%b;
printf("Answer:%f",c);
break;
}

default:
{
printf("\nCheck your entery:");
printf("\nSorry!!!\n Try again\n");
goto j;
}

}
getch();
}


For convert real no. into integer no.

#include< stdio.h >
#include< conio.h >

void main()
{
float a,b;
clrscr();

printf("Enter no:");
scanf("%f",&a);

b=a-(int)a;

if(b>=0.5)
printf("Number=%d",(int)a+1);

else
printf("Number=%d",(int)a);

getch();
}


Write a programe for ATM machine process in c language

#include< stdio.h >
#include< conio.h >
void main()
{
long int a,n=0,m=0,j=0;
clrscr();
printf("Enter value of case:");
scanf("%ld",&a);
if(a%100==0)
{
while(a>1000)
{
n++;
a=a-1000;
}

while(a>500)
{
m++;
a=a-500;
}
while(a>=100)
{
j++;
a=a-100;
}
printf("\nnote of 1000:%ld",n);
printf("\nnote of 500:%ld",m);
printf("\nnote of 100:%ld",j);

}

else
{
printf("Please enter value in multiplication of 100");
}

getch();
}