Tuesday, August 28, 2007

CELCIUS TO FAHRENHEIT

WAP to Convert CELCIUS to fahrenheit

void main ()

{

float c,f;

clrscr ();

printf ("Enter the value of celcius: ");

scanf ("%f",&c);

f=(float) 9/5*c+32;

printf ("\nFahrenheit is %.2f",f);

getch ();

}

%AGE OF TOTAL MARKS

WAP to find out total marks & Percentage of three subjects

void main ()

{

int m1,m2,m3;

float tm,per;

clrscr ();

printf ("Enter M1: ");

scanf ("%d",&m1);

printf ("Enter M2: ");

scanf ("%d",&m2);

printf ("Enter M3: ");

scanf ("%d",&m3);

tm=m1+m2+m3;

per=(tm/300*100);

printf ("\nTotal Marks are %.2f",tm);

printf ("\nPercentage is %.2f",per);

getch ();

}




CALCULATE TOTAL MARKS

WAP to find out total marks of three subjects


void main ()

{

int m1,m2,m3,tm;

clrscr ();

printf ("Enter M1: ");

scanf ("%d",&m1);

printf ("Enter M2: ");

scanf ("%d",&m2);

printf ("Enter M3: ");

scanf ("%d",&m3);

tm=m1+m2+m3;

printf ("\nTotal Marks are %d",tm);

getch ();

}


VALUE OF DATA TYPE

WAP to print value of multiple data types

#include

#include

void main ()

{

int a=10;

float d=40.50;

char ch='A';

double dbl=78.9786;

long lng=7897711;

char nm [10]="JIMMY";

clrscr ();

printf ("\nInteger value is %d",a);

printf ("\nFloat value is %.2f",d);

printf ("\nCharacter value is %c",ch);

printf ("\nDouble value is %.4lf",dbl);

printf ("\nLong value is %ld",lng);

printf ("\nString value is %s",nm);

getch ();

}

SQUARE ROOT

WAP to find out Square root of any number

#include

#include

void main ()

{

int no, a;

clrscr ();

printf ("Enter Number : ");

scanf ("%d",&no);

a=sqrt(no);

printf ("\nResult is %d", a);

getch ();

}


Output

POWER OF VARIABLE

WAP to find out power of any number

#include

#include

void main ()

{

double no,r,res;

clrscr ();

printf ("Enter Number : ");

scanf ("%lf",&no);

printf ("Enter raised : ");

scanf ("%lf",&r);

res=pow(no,r);

printf ("\nResult is %.2lf", res);

getch ();

}


Output

AREA OF CIRCLE

WAP to find out areA of circle

#include

void main ()

{

float r,c;

clrscr();

printf ("Enter Radius: ");

scanf ("%f",&r);

c=3.14*r*r;

printf ("\nArea is : %.2f",c);

getch ();

}


Output