counter

Free Hit Counter

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();
}

Addition of two matrices

Publish Post
#include
#include
void main()
{
int a[10][10], b[10][10], c[10][10], i, j, row, col;
clrscr();
printf("\nEnter number of rows and columns: ");
scanf("%d %d", &row, &col);
printf("\nEnter elements of Array A:\n");
for (i=0; i
{
for (j=0; j
{
scanf("%d", &a[i][j]);
printf("\nEnter elements of Array B:\n");
}
for (i=0; i
{
for (j=0; j
{

scanf("%d", &b[i][j]);
printf("\nElements of Matrix A:\n\n");
}
for (i=0; i
{
for (j=0; j
{

printf("\t%d", a[i][j]);
}
printf("\n\n");
}

}
printf("\nMatrix B:\n\n");
for (i=0; i
{
for (j=0; j
{
printf("\t%d", b[i][j]);
}
printf("\n\n");
}
for (i=0; i
{
for (j=0; j
{
c[i][j] = a[i][j] + b[i][j];
}
printf("\nAddition is:\n\n");
}
for (i=0; i
{
for (j=0; j
{
printf("\t%d", c[i][j]);
}
printf("\n");
}
getch();
}
}

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();
}