Sunday, October 3, 2010

write a program to accept temperature in centigrade degree and convert it into Fahrenheit degrees..

#include
#include
void main()
{
int b,d,e;
float c,f;

clrscr();
printf("\n\t Enter the temperature\t:\t");
scanf("%f",&f);
b=5;
d=9;
e=32;
c=b*(f-e)/d;
printf("\n\t Fahrenheit degree\t:\t%0.2f C",c);
getch();
}

write a program to accept a number from user and print its square and cube.

#include
#include
#include
void main()
{
int a,b,c;
clrscr();
printf("\n\t Enter the value of square and cube\t:\t");
scanf("%d",&a);
b=pow(a,2);
c=pow(a,3);
printf("\n\t\t\t\tsquare\t\t:\t%d\n\n\t\t\t\t cube\t\t:\t%d",b,c);
getch();
}

write a program to accept the selling price form user whether the seller has made profit or incurred loss. also determine how much profit he made or loss he incurred

#include
#include
void main()
{
float cp,sp,p,l;// cp=cost price,sp=seller price, p=profit,l=loss

clrscr();
printf("Enter cost price\t:\t");
scanf("%f",&cp);
printf("Enter cost selling price\t:\t ");
scanf("%f",&sp);
p=sp-cp;
l=cp-sp;
if(p>0)
printf("The seller has made a profit of Rs.%.2f",p);
if(l>0)
printf("The seller is in loss by Rs.%.2f",l);

getch();
}

write a program for Employee salary and calculate it with only hra and ta with basic salary of employee in c.

#include
#include

void main ()
{
long int sal,hra,ta,ts;
clrscr ();
printf ("Enter Salary: ");
scanf("%ld",&sal);
if (sal>=5000)
{
hra=sal*.10;
ta=sal*.07;
}
else
{
hra=sal*.08;
ta=sal*.05;
}
ts=sal+hra+ta;
printf ("\n\nTotal Salary is Rs.%ld", ts);
getch ();
}

write a program for Employee salary and calculate it with all step in c.

 #include
#include

void main()
{

/* id=employee id,b_sal=employee basic salary,hra=basic*0.30%,
da=basic*0.50%,ta=hra+da*0.50%,other=500,pf=(basic+hra)*5%,pt=(basic+hra)*2% */

int id;
int hra,da,ta,others,pf,pt;
int net_sal,sal;
clrscr();
printf("\n\t Enter the Employee id\t:\t");
scanf("%d",&id);
printf("\n\t Enter the Basic salary\t:\t");
scanf("%d",&sal);
hra=sal*0.30/100;
da=sal*0.30/100;
ta=da+hra*0.50/100;
others=500;
pf=(sal+hra)*5/100;
pt=(sal+hra)*2/100;
net_sal=(sal+hra+da+ta+others)-(pf+pt);
printf("\n\t Net salary=%d",net_sal);
getch();
}

write a program to accept two number and find the remainder on dividing them

#include
#include
void main()
{
int a,b,c;
clrscr();
printf("\n\t Enter the  any two number\t:\t");
scanf("%d%d",&a,&b);
// equation of remainder in c-convertion


c=a%b;
printf("\n\t the remainder on dividing them\t:\t%d",c);
getch();
}

write a program for accept the number from user and find is number are prime or not ?

 #include
#include

void main()
{
int n,a,c=0;
clrscr();
printf("Enter number to be checked\n");
scanf("%d",&n);
for(a=2;a
{
if(n%a==0)
c++;
}
if(c>0)
printf("Not a prime number\n");
else printf("Prime number\n");
getch();
}

write a program for accept the number from user and find witch number are odd and even ?

#include
#include

void main()
{
int a,b;
int c,d;
clrscr();
printf("\n\t Its a Odd number");
for(a=1;a<=25;a+=2)
printf("%d\n",a);
printf("\n\t Its a Even number");
c=25;
for(d=2;d
{
printf("%d\n",d);
}
getch();
}

write a program for accept the number form user and print this Addition,Division,Subtraction,Multiplication,Modulus i?

 #include
#include
void main()
{
int a, b, c, d, e, f, g;
clrscr();
printf("\n\t Enter any number\t\t:\t");
scanf("%d",&a);
printf ("\n\t Enter any number\t\t:\t");
scanf("%d",&b);
c=a+b;
printf ("\n\n\t The Adition is\t\t\t:\t%d",c);
d=a-b;
printf ("\n\n\t The subtraction is\t\t:\t%d",d);
e=a*b;
printf ("\n\n\t The Multiplication is\t\t:\t%d", e);
f=a/b;
printf ("\n\n\t The Division is\t\t:\t%d",f);
g=a%b;
printf ("\n\n\t The modulus is\t\t\t:\t%d",g);
getch();
}

write a program to using arithmetic operator in c?

#include
#include
void main()
{
int a;
clrscr();
printf("\n\t Enter the Value of A\t:\t");
scanf("%d",&a);
printf("\n\n\t Value of A is\t\t:\t%d",a);
printf("\n\n\t Value of A is\t\t:\t%d",++a);
printf("\n\n\t Value of A is\t\t:\t%d",a++);
printf("\n\n\t Value of A is\t\t:\t%d",a);
printf("\n\n\t Value of A is\t\t:\t%d",--a);
printf("\n\n\t Value of A is\t\t:\t%d",a--);
printf("\n\n\t Value of A is\t\t:\t%d",a);
getch();
}

write a program to accept the year form user to determine whether the year is a leap year or not ?

 #include
#include
void main()
{
int year;
clrscr();
printf("\n\t Enter the year \t:\t");
scanf("%d",&year);

if(year%4==0)
printf("\n\t%d its a leep year",year);
else
printf("\n\t%d its aa not a leep year",year);

getch();
}

how will you convert a hexadecimal ABC into its octal and decimal equivalent ?

 #include
#include
void main()
{
int a,b,c;
int h=16,i=8,j=10;
long e,f,g;
long m,n,o,p;// modulas
long u,v,x,y,z;//dividing

clrscr();
printf("\n\t The Hexadecimal Value is\t:\tABC");
a=10;
b=11;
c=12;
e=a+(b*h)+(c*h*h);

printf("\n\n\t the decimal value is\t\t:\t%ld",e);
f=e/i;
m=e%i;
n=f/i;
u=f%i;
x=u/i;
o=u%i;
printf("\n\n\t The Octal value is\t\t:\t%d%d%d",m,u,o);



getch();
}

write a program to accept the any two number and Mach its witch number is getter and less in one ?

 

void main()
{
     int a,b,c,d;
     clrscr();
     printf("\n\t Enter the Value of A\t:\t");
     scanf("%d",&a);
     printf("\n\t Enter the Value of B\t:\t");
     scanf("%d",&b);
     c=a-b;
     d=c+abs(c);      // to check if the difference is negative or not
     if(d==0)
     printf("\n\t\t\t\t * Answer *");
     printf("\n\t A is smaller than B");
     else
     printf("\n\t A is bigger than B");
     getch();
}

write a program to accept the any two number and Mach its witch number is getter and less in one ?

#include
#include
void main()
{
int a,b,c;
int d,e;
clrscr();
printf("\n\t  Enter tha Number A\t:\t");
scanf("%d",&a);
printf("\n\t  Enter the Number B\t:\t");
scanf("%d",&b);
c=a+b;
d=ab;
e=c+d;
if (c==0) printf("\n\t A is equal to B");
else if(e==0) printf("\n\t A is smaller then B");
else printf("\n\t A is bigger the B");
printf("%d",d);


getch();
}

write a programing to accept the number of days and calculate the number of months they make in c?

#include
#include
void main()
{
int days;
int month;
clrscr();
printf("\n\t Enter the days\t:\t");
scanf("%d",&days);
month=days/30;
days=days%30;
printf("\n\a\a\a\t\tmonth\t:\t%d\n\t\tdays\t:\t%d",month,days);

getch();

}

write a programing to accept the cost of Qty to the user and print with Tex ?


#include
#include
void main()
{

float cost,tax,luxury,total;
clrscr();
luxury=0.0;
printf("\n\tEnter the cost of the item\t:\t");
scanf("%f", &cost);
tax=cost*0.06;
if(cost>40000.0)
luxury=cost*0.005;
total=cost+tax+luxury;
printf("\n\t the total cost is \t\t:\t%0.2f",total);
getch();

}

write a program for AND Operator to getting the your % in c-programing ?

#include
#include


void main()
{
int a,b,c,d,e,f;
clrscr();
printf("\n\t Enter the marks of 1st subject\t\t:\t");
scanf("%d",&a);
printf("\n\t Enter the marks of 2nd  subject\t:\t");
scanf("%d",&b);
printf("\n\t Enter the marks of 3rd  subject\t:\t");
scanf("%d",&c);
printf("\n\t Enter the marks of 4th subject\t\t:\t");
scanf("%d",&d);
printf("\n\t Enter the marks of 5th subject\t\t:\t");
scanf("%d",&e);


f=(a+b+c+d+e)/5;


if(f>=60)
printf("\n\t\t\t Your are pass\n\n\t\t First Division\t\t:\t%d",f);
if((f>=50)&&(f<60))
printf("\n\t\t\t Your are pass\n\n\t\t Second Division\t\t:\t%d",f);
if((f>40)&&(f<50))
printf("\n\t\t\t Your are pass\n\n\t\t Third Division\t\t:\%dt",f);
if(f<40)
printf("\n\t\t\t Your are fail\n\n\t\t Fourth Division\t\t:\t%d",f);


getch();
}

write a program for AND Operator using C programing ?

#include
#include
void main()
{
int a;
clrscr();
printf("\n\t Enter the any number less than 10\t:\t");
scanf("%d",&a);
if(a<=10)
printf("\n\t\t You are a good student");
if(a>=10)
printf("\n\t\t You are a very bad student");


printf("\n\n\t Enter the any number less than 10\t:\t");
scanf("%d",&a);
if(a<=10)
printf("\n\t\t You are a good student");
if(a>=10)
printf("\n\t\t You are a very bad student");
getch();
}

its magic for your

#include
#include
void main()
{
long a,b,c;
long g,e;
clrscr();
printf("\n\t Enter the your age\t:\t");
scanf("%ld",&a);
b=259;
c=39;
g=a*b;
e=g*c;
printf("\n\tIts magic for you\t\t:\t%ld",e);
getch();
}