Write a program that input two numbers and prints addition,subtraction,multiplication and division.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,sum,sub,mul,div;
clrscr();
printf("Enter number a=");
scanf("%d \n",&a);
printf("Enter number b=");
scanf("%d \n",&b);
sum=a+b; //This will perform addition.
sub=a-b; //This will perform subtraction.
mul=a*b; //This will perform multiplication.
div=a/b; //This will perform division.
printf("Sum = %d \n",sum);
printf("Sub = %d \n",sub);
printf("Mul = %d \n",mul);
printf("Div = %d \n",div);
getch();
}
Output:
Enter number a=5
Enter number b=3
Sum = 8
Sub = 2
Mul = 15
Div = 1
0 Comments