Banner Header

Tuesday, 29 August 2017

C Program Multiplication of two numbers

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.





Finally, the mulofTwoNumbers is displayed on the screen using printf() function.

Click on the download button to download file

download button

C Program Multiplication of two numbers Reviewed by Waqas Ahmed Mir PC on August 29, 2017 Rating: 5 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 variab...

No comments: