counter

Free Hit Counter
Showing posts with label Playing around operators. Show all posts
Showing posts with label Playing around operators. Show all posts

Simple C program to print Net salary of user




Q:Write a program to find out the net salary of an employee,get the basic salary from him.TA=5%,DA=64%,HRA=12% on his basic salary,TAX=3%,PF=12% on his gross salary




#include
#include
void main()
{
float bs,ta,da,hra,gs,tax,pf,ns;
clrscr();

printf("\tEnter basic salary:");
scanf("%f",&bs);
ta=(0.05*bs);
da=(0.64*bs);
hra=(0.12*bs);
gs=ta+da+hra+bs;
tax=(0.03*gs);
pf=(0.12*gs);
ns=gs-tax-pf;

printf("\t\tnet salary:%f\n",ns);
getche();
}

Simple C program to convert years into minutes



Q:Write a program that prints time in minutes when time in years is input by the user



#include
#include
void main()
{
float y,m;
clrscr();

printf("\tEnter no. of years:");
scanf("%f",&y);
m=y*31536000;
printf("\t\tno. of minutes:%f\n",m);
getche();
}

Simple C program to Age in minutes and days




Q:Write a program where in user is asked to input the age in years and program displays his age in months and days


#include
#include
void main()
{
float y,m,d;
clrscr();

printf("\tEnter age in years:");
scanf("%f",&y);
m=y*12;
d=y*365;
printf("age in months:%f\n",m);
printf("age in days:%f\n",d);
getche();
}

C program to demonstrate use of arithmetic operators



Q:Write a program that prints Addition,subtraction,multiplication and division of two nos



#include
#include
void main()
{
float a,b,c,sum,product,division,subtraction;
clrscr();

printf("\tEnter a:");
scanf("%f",&a);
printf("\tEnter b:");
scanf("%f",&b);
sum=a+b;
product=a*b;
division=a/b;
subtraction=a-b;
printf("sum=%f\nproduct=%f\ndivision=%f\nsubtraction=%f",sum,product,division,subtraction);
getche();
}

Simple C program to print alphabets,numbers and special characters



Q: C program to print alphabets,numbers and special characters on the output screen


#include
#include
void main()
{
clrscr();
printf("");
getche();
}

Simple C program to print hello n how are you


Q: Write a program that prints hello on first line and How are you on second lineUsing simple printf statement


#include
#include
void main()
{
clrscr();
printf("\t\t hello \n\t How are you?");
getche();
}