C Program to perform arithmetic operations. I have used Code:: Blocks compiler for debugging purpose. But you can use any C programming language compiler as per your availability.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include <stdio.h> int main() { int num1, num2; int sum, sub, mult, mod; float div; printf("Enter first number : "); scanf("%d", &num1); printf("Enter second number : "); scanf("%d", &num2); sum = num1 + num2; sub = num1 - num2; mult = num1 * num2; mod = num1 % num2; div = (float)num1 / num2; printf("Sum of num1 and num2 = %d \n", sum); printf("Difference of num1 and num2 = %d \n", sub); printf("Product of num1 and num2 = %d \n", mult); printf("Modulus of num1 and num2 = %d \n", mod); printf("Quotient of num1 and num2 = %f ", div); return 0; } |
26 February 2019 2844 Written By: Rohit Mhatre
© 2020 Tech Study. All rights reserved | Developed by Tech Study| Privacy Policy | Sitemap