Tuesday, August 28, 2007

SUM,SUB,PRODUCT,DIVISION

WAP to Sum, Subtract, Multiply & Division of two numbers (5 Variables)

#include

void main ()

{

int a,b,c,d,e,f;

clrscr();

printf ("Enter A: ");

scanf ("%d",&a);

printf ("Enter B: ");

scanf ("%d",&b);

c=a+b;

d=a-b;

e=a*b;

f=a/b;

printf ("\nSum is : %d",c);

printf ("\nSubtraction is : %d",d);

printf ("\nMultiplication is : %d",e);

printf ("\nDivision is : %d",f);

getch ();

}


Output




Method #2

WAP to Sum, Subtract, Multiply & Division of two numbers (3 Variables)

#include

void main ()

{

int a,b,c;

clrscr();

printf ("Enter A: ");

scanf ("%d",&a);

printf ("Enter B: ");

scanf ("%d",&b);

c=a+b;

printf ("\nSum is %d",c);

c=a-b;

printf ("\nSubtraction is %d",c);

c=a*b;

printf ("\nMultiplication is %d",c);

c=a/b;

printf ("\nDivision is %d",c);

getch ();

}


Output


No comments:

Post a Comment