#include
#include
void main()
{
int num;
clrscr();
printf("Enter any integer");
scanf("%d",&num);
printf("%c",num);
getch();
}
/*Program to find maximum of two numbers*/
#include
#include
void main()
{
int a,b;
clrscr();
printf("Enter any nmber");
scanf("%d",&a);
printf("Enter another number");
scanf("%d",&b);
if(a>b)
printf("A is greater");
else
printf("B is greater");
getch();
}
/*Program to Display maximum of four numbers*/
#include
#include
void main()
{
int a,b,c,d;
printf("Enter any four numbers");
scanf("%d,%d,%d,%d",&a,&b,&c,&d);
if(a>b && a>c && a>d)
printf("A is greater");
else
if(b>c && b>d)
printf("B is greater");
else
if(c>d)
printf("C is greater");
else
printf("D is greater");
getch();
}
/*Program to find commission of a salesman*/
#include
#include
void main()
{
long int sal;
float com;
clrscr();
printf("Enter sales");
scanf("%ld",&sal);
if(sal>=50000)
com=sal*10/100;
else
com=sal*5/100;
printf("Commission is = %f", com);
getch();
}
/*Program to calcualte total, per & specify pass or fail*/
#include
#include
void main()
{
int m1,m2,m3,tot;
float per;
clrscr();
printf("Enter marks of I subject");
scanf("%d",&m1);
printf("Enter marks of II subject");
scanf("%d",&m2);
printf("Enter marks of III subject");
scanf("%d",&m3);
tot=m1+m2+m3;
per=(float) tot/300*100;
if(per>=36)
printf("Pass");
else
printf("Fail");
getch();
}
/*Program to Display whether the year is Leap or Not*/
#include
#include
void main()
{
int yr;
clrscr();
printf("Enter any Year");
scanf("%d",&yr);
if((yr%4)==0)
printf("Leap Year");
else
printf("Not a Leap Year");
getch();
}
No comments:
Post a Comment