Perform All Arithmetic Operations In C
Write a C program to perform all arithmetic operations such as addition, subtraction, division, multiplication and modulo division of two numbers.
C Program to perform all arithmetic operations
#include<stdio.h>
int main()
{
int a,b,sum,sub,prod,div;
printf("\n \n Enter Your Numbers:");
scanf("%d%d",&a,&b);
sum=a+b;
sub=a-b;
prod=a*b;
div=a/b;
mod=a%b;
printf("\n The Sum of Two Given Numbers is %d",sum);
printf("\n The Subtraction of Two Give Numbers is %d",sub);
printf("\n The Product of Two Given Numbers is %d",prod);
printf("\n The Division of Two Given Numbers is %d",div);
printf("\n The modulo division of %d and %d is %d \n \n",a,b,mod);
return 0;
}
Output:
Enter Your Numbers:12 12 The Sum of Two Given Numbers is 24 The Subtraction of Two Give Numbers is 0 The Product of Two Given Numbers is 144 The Division of Two Given Numbers is 1 The modulo division of 12 and 12 is 0
Comments