Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

C program to calculate remainder, difference, division, product

C Program to calculate sum, difference, product, division and remainder of two numbers ?

Sol.
#include <stdio.h>

int main()

{

int num1, num2, sum, difference, product, remainder ;

float division;

printf( “Please enter two numbers: “);

scanf(“%d %d”, & num1, & num2);

sum = num1 + num2;

difference = num1  num2;

product = num1 * num2;

division = num1 / (float)num2; //typecasting

remainder = num1 % num2;

printf(“Sum = %d n”, sum);

printf(“Difference = %d n”, difference);

printf(“Product = %d n”, product);

printf(“Division = %f n”, division);

printf(“Remainder = %d n”, remainder);

return 0;

}
Output: