Tuesday, January 4, 2011

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