Computer Science, asked by Princesspopstar4504, 1 year ago

write a c program to enter two numbers and perform all arithmetic operations

Answers

Answered by anand45rspdnpc9
4

/** * C program to perform all arithmetic operations */ #include <stdio.h> int main() { int num1, num2; int sum, sub, mult, mod; float div; /* * Input two numbers from user */ printf("Enter any two numbers: "); scanf("%d%d", &num1, &num2); /* * Perform all arithmetic operations */ sum = num1 + num2; sub = num1 - num2; mult = num1 * num2; div = (float)num1 / num2; mod = num1 % num2; /* * Print result of all arithmetic operations */ printf("SUM = %d\n", sum); printf("DIFFERENCE = %d\n", sub); printf("PRODUCT = %d\n", mult); printf("QUOTIENT = %f\n", div); printf("MODULUS = %d", mod); return 0; }
Similar questions