C Program To Add, Subtract, Multiply, Divide Two Numbers
♣ Try it Out ::
#include<stdio.h> #include<conio.h> int main() { int num1, num2; printf("\nEnter two Integers: "); scanf("%d %d", &num1, &num2); int add = num1 + num2; int sub = num1 - num2; int mul = num1 * num2; float div = 1.0 * num1 / num2; printf("\nSum of two numbers: %d + %d = %d\n", num1, num2, add); printf("Difference of two numbers: %d - %d = %d\n", num1, num2, sub); printf("Multiplication of two numbers: %d * %d = %d\n", num1, num2, mul); printf("Division of two numbers: %d / %d = %.2f", num1, num2, div); getch(); return(0); }
♣ Output ::
Enter two Integers: 8 7 Sum of two numbers: 8 + 7 = 15 Difference of two numbers: 8 - 7 = 1 Multiplication of two numbers: 8 * 7 = 56 Division of two numbers: 8 / 7 = 1.14
♣ Downloads ::
Comments
Post a Comment