C Program to Mul Two Numbers
In this program, user is asked to enter two integers. Then, the mul of those two integers is stored in a variable and displayed on the screen.
Program to Mul Two Integers
#include <stdio.h> #include <conio.h> int main() { int firstNumber, secondNumber, mulOfTwoNumbers; printf("Enter two integers: "); // Two integers entered by user is stored using scanf() function scanf("%d %d", &firstNumber, &secondNumber); // mul of two numbers in stored in variable mulOfTwoNumbers mulOfTwoNumbers = firstNumber * secondNumber; // Displays muliplication printf("%d * %d = %d", firstNumber, secondNumber, mulOfTwoNumbers); getch(); } |
Output
Enter two integers: 22
43
22 * 43 = 946
In this program, user is asked to enter two integers. Two integers entered by the user is stored in variables firstNumber and secondNumber respectively. This is done using
scanf()
function.Then, variables firstNumber and secondNumber are subtracting using - operator and the result is stored in mulOfTwoNumbers.
No comments: