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
AD4BP
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
#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
#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
#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
#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
#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
#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();
}
#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();
}
#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();
}
#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();
}
Write a c programe to decide given no is armstrong or not?.
#include< stdio.h >
#include< conio.h >
void main()
{
int a,b,sum=0,n;
clrscr();
printf("enter no:");
scanf("%d",&n);
b=n;
while(n>0)
{
a=n%10;
sum=sum+(a*a*a);
n=n/10;
}
if(b==sum)
{
printf("Armstrong no");
}
else
{
printf("Not Armstong no");
}
getch();
}
#include< conio.h >
void main()
{
int a,b,sum=0,n;
clrscr();
printf("enter no:");
scanf("%d",&n);
b=n;
while(n>0)
{
a=n%10;
sum=sum+(a*a*a);
n=n/10;
}
if(b==sum)
{
printf("Armstrong no");
}
else
{
printf("Not Armstong no");
}
getch();
}
Write program for find the area of circle.
#include< stdio.h >
#include< conio.h >
void main( )
{
float r,a;
clrscr( );
printf("Enter radious of circle: ");
scanf("%f",&r);
a=3.14*r*r;
printf("Area of circle: %2.2f",a);
getch( );
}
Output:-
Enter radious of circle:
Area of circle:
#include< conio.h >
void main( )
{
float r,a;
clrscr( );
printf("Enter radious of circle: ");
scanf("%f",&r);
a=3.14*r*r;
printf("Area of circle: %2.2f",a);
getch( );
}
Output:-
Enter radious of circle:
Area of circle:
Write a programe for decide the entered year is leap year or not?
#include< stdio.h >
#include< conio.h >
void main()
{
int a;
clrscr();
printf("Enter year:");
scanf("%d",&a);
if(a%4==0 && a%100==0)
{
printf("Year %d is leap year");
}
else
{
printf("Year %d is not leap year");
}
getch();
}
#include< conio.h >
void main()
{
int a;
clrscr();
printf("Enter year:");
scanf("%d",&a);
if(a%4==0 && a%100==0)
{
printf("Year %d is leap year");
}
else
{
printf("Year %d is not leap year");
}
getch();
}
Write the programme for make simple calculator
#include< stdio.h >
#include< conio.h >
void main()
{
char op;
int a,b;
float ans;
clrscr();
printf("first is :");
scanf("%d",&a);
printf("second is :");
scanf("%d",&b);
fflush(stdin);
printf("oprater:",op );
scanf("%c",&op);
if (op=='+')
{
ans=a+b;
printf("Answer=%f",ans);
}
else if (op=='-')
{
ans=a-b;
printf("Answer=%f",ans);
}
else if (op=='*')
{
ans=a*b;
printf("Answer=%f",ans);
}
else if (op=='%')
{
ans=a%b;
printf("Answer=%f",ans);
}
else if (op=='/')
{
if (a==0||b==0)
{
printf("Check your entry\n Mathematics Error");
}
else
{
ans=a/b;
printf("Answer=%f",ans);
}
}
getch();
}
Output:-
First is:(enter value)
Second is: (enter value)
Operator: (enter value)
Answer:
#include< conio.h >
void main()
{
char op;
int a,b;
float ans;
clrscr();
printf("first is :");
scanf("%d",&a);
printf("second is :");
scanf("%d",&b);
fflush(stdin);
printf("oprater:",op );
scanf("%c",&op);
if (op=='+')
{
ans=a+b;
printf("Answer=%f",ans);
}
else if (op=='-')
{
ans=a-b;
printf("Answer=%f",ans);
}
else if (op=='*')
{
ans=a*b;
printf("Answer=%f",ans);
}
else if (op=='%')
{
ans=a%b;
printf("Answer=%f",ans);
}
else if (op=='/')
{
if (a==0||b==0)
{
printf("Check your entry\n Mathematics Error");
}
else
{
ans=a/b;
printf("Answer=%f",ans);
}
}
getch();
}
Output:-
First is:(enter value)
Second is: (enter value)
Operator: (enter value)
Answer:
Write a programe convert ASCII no into related character.
Input:-
#include
#include
void main( )
{
int n;
clrscr( );
printf("Enter ASCII no:");
scanf("%d",&n);
printf("ASCII no %d is for character %c",n,n);
getch( );
}
Output:-
Enter ASCII no:97
ASCII no 97 is for character a
#include
#include
void main( )
{
int n;
clrscr( );
printf("Enter ASCII no:");
scanf("%d",&n);
printf("ASCII no %d is for character %c",n,n);
getch( );
}
Output:-
Enter ASCII no:97
ASCII no 97 is for character a
Write a programe convert Character into its ASCII value.
#include< stdio.h >
#include< conio.h >
void main( )
{
char c;
clrscr( );
printf("Enter Character: ");
scanf("%c",&c);
printf("Character %c 's ASCII no=%d",c,c);
getch( );
}
Output:-
Enter Character: N
Character N 's ASCII no=78
#include< conio.h >
void main( )
{
char c;
clrscr( );
printf("Enter Character: ");
scanf("%c",&c);
printf("Character %c 's ASCII no=%d",c,c);
getch( );
}
Output:-
Enter Character: N
Character N 's ASCII no=78
Write a programe convert rupees into paisa.Note:-1 rupee=100 paisa
#include< stdio.h >
#include< conio.h >
void main( )
{
int p;
float r;
clrscr( );
printf("\nEnter rupees= ");
scanf("%f",&r);
p=100*r;
printf("\nPaisa=%d",p);
getch( );
}
#include< conio.h >
void main( )
{
int p;
float r;
clrscr( );
printf("\nEnter rupees= ");
scanf("%f",&r);
p=100*r;
printf("\nPaisa=%d",p);
getch( );
}
Write a programe for calculation of addition, sub, multy, div of given two number
#include< stdio.h >
#include< conio.h >
void main( )
{
int a,b,c;
float d;
clrscr( );
printf("Enter first no: ");
scanf("%d",&a);
printf("Enter second no: ");
scanf("%d",&b);
c=a+b;
printf("\nAddition=%d",c);
c=a-b;
printf("\nSubstraction=%d",c);
c=a*b;
printf("\nMultiplication=%d",c);
c=a%b;
printf("\nModulow=%d",c);
d=a/b;
printf("\nDivision=%2.2f",d);
getch( );
}
#include< conio.h >
void main( )
{
int a,b,c;
float d;
clrscr( );
printf("Enter first no: ");
scanf("%d",&a);
printf("Enter second no: ");
scanf("%d",&b);
c=a+b;
printf("\nAddition=%d",c);
c=a-b;
printf("\nSubstraction=%d",c);
c=a*b;
printf("\nMultiplication=%d",c);
c=a%b;
printf("\nModulow=%d",c);
d=a/b;
printf("\nDivision=%2.2f",d);
getch( );
}
Write a programe for print your address in center of output screen.
#include< stdio.h >
#include< conio.h >
void main( )
{
clrscr( );
printf("\n\t\t\tPatel Ankit");
printf("\n\t\t\t12\Sardar Bunglows");
printf("\n\t\t\tShivaji chowk, Shahibagh");
printf("\n\t\t\tAhmedabad");
getch( );
}
#include< conio.h >
void main( )
{
clrscr( );
printf("\n\t\t\tPatel Ankit");
printf("\n\t\t\t12\Sardar Bunglows");
printf("\n\t\t\tShivaji chowk, Shahibagh");
printf("\n\t\t\tAhmedabad");
getch( );
}
Write a programe for print "Hello World" in c language
#include< stdio.h >
#include< conio.h >
void main( )
{
int a;
clrscr( );
printf("Hello world");
getch( );
}
Output
Hello world
#include< conio.h >
void main( )
{
int a;
clrscr( );
printf("Hello world");
getch( );
}
Output
Hello world
Subscribe to:
Posts (Atom)