C Program to find sum, multiply, divide and remainder of two numbers
Make a simple C program to find the sum (addition), multiply, subtract, divide and remainder of two numbers. C program will be as follows -
/*C program to find remainder(modulus), sum, subtract, multiply and divide two numbers */
#include<stdio.h>
void main()
{
int a,b,sum,sub,mul,rem;
float division;
printf("Enter any two numbers a and b to sum, subtract, multiply, divide and find remainder of these two numbers\n");
scanf("%d%d",&a,&b);
sum=a+b;
sub=a-b;
mul=a*b;
division=(float)a/b;
rem=a%b;
printf("\n Sum of %d and %d is \t %d",a,b,sum);
printf("\n Subtraction of %d and %d is \t %d",a,b,sub);
printf("\n Multiplication of %d and %d is \t %d",a,b,mul);
printf("\n Division of %d and %d is \t %f",a,b,division);
printf("\n remainder of %d and %d is \t %d",a,b,rem);
getch();
}
Input – Enter any two numbers- 5 4
Output -
Sum is - 9
Subtraction – 1
Multiplication – 20
Division – 1.25
Modulus is 1
No comments yet