To find leap year
Topics Covered:
- To find greatest number among three different number
- To find gain or loss
- To read salary of an employee and decide tax amount
- To read age of a person and find out the category
- To find leap year
//to find greatest number among three different number
#include<conio.h>
#include<stdio.h>
int main()
{
int a,b,c,l;
printf(“enter any three different number”);
scanf(“%d%d%d”,&a,&b,&c);
if(a>b&&a>c)
l=a;
else if(b>a&&b>c)
l=b;
else
l=c;
printf(“largest number=%d”,l);
return 0;
}
//to find gain or loss
#include<conio.h>
#include<stdio.h>
int main()
{
float cp,sp,p,l;
printf(“enter cost price”);
scanf(“%f”,cp);
printf(“enter selling price”);
scanf(“%f”,sp);
if(sp>cp)
{
p=sp-cp;
printf(“the profit amount is rs%.2f”,p);
}
else if(cp>sp)
{
l=cp-sp;
printf(“the loss amount is rs%.2f”,l);
}
else
printf(“their is neither profit nor loss”);
return 0;
}
//to read salary of an employee and decide tax amount
#include<conio.h>
#include<stdio.h>
int main()
{
int s,t;
printf(“enter your salary”);
scanf(“%d”,&s);
if(s<=100000)
t=0;
else if(s<=150000)
t=(s-100000)*0.15;
else
t=(50000*0.15)+(s-150000)*0.25;
printf(“tax amount=%d”,t);
return 0;
}
// to read age of a person and find out the category
#include<conio.h>
#include<stdio.h>
int main()
{
int c,i,al,ml,oa,a;
printf(“enter your age”);
scanf(“%d”,&a);
if(a<=12)
printf(“you belongs to child”);
else if(a<=19)
printf(“you belongs to teeneger”);
else if(a<=30)
printf(“you belongs to adult life”);
else if(a<=50)
printf(“you belongs to mature life”);
else
if(a>50)
printf(“you belongs to old age”);
return 0;
}
//to find leap year
#include<conio.h>
#include<stdio.h>
int main()
{
int l,y;
printf(“enter a numbers of year”);
scanf(“%d”,&y);
if(y%4==0)
printf(“it a is leap year”);
else
if(y%4!=0)
printf(“this is not leap year”);
return 0;
}