Monday, June 18, 2012

To perform basic arithmetic operations


/* To perform basic arithmetic operations */

#include<stdio.h>

#include<conio.h>

void main()

{

 int a,b,add,sub,mul,div;

 clrscr();

 printf("Enter the First Number:\n");

 scanf("%d",&a);

 printf("Enter the Second Number:\n");

 scanf("%d",&b);

 add=a+b;        /* Addition */

 sub=a-b;         /* Subtraction */

 mul=a*b;        /* Multiplication */

 div=a/b;         /* Division */

 printf("\n\Arithmetic Operations:\n");

 printf("\nAddition=%d",add);

 printf("\nSubtraction=%d",sub);

 printf("\nMultiplication=%d",mul);

 printf("\nDivision=%d",div);

 getch();

}

 

OUTPUT

Enter the First Number:

89

Enter the Second Number:

34

 

 

Arithmetic Operations:

 

Addition=123

Subtraction=55

Multiplication=3026

Division=2

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.