In my previous post, I wrote about Subtracting two numbers in C. Now let’s multiply two numbers in C. Again, it’s similar to Adding two numbers in C and Subtracting two numbers in C. Instead of using the ‘+’ or ‘-‘ operator, we use ‘*’ operator which performs the task of multiplying two things. If you are unsure about any part and more information, put it down in the comments section below or look it up on Google if you want quick response. We will try to get back to you as soon as we see the comment.
Download the source code:
Download ProgramAlgorithm to multiply two numbers in C:
1) Start
2) Accept Number one
3) Accept Number two
4) Multiply both the numbers
5) Print the result.
6) End
Program to multiply two numbers in C:
/*Program to multiply two numbers in C. Programmer: Harsh Shah, Date: 29/6/13*/ #include<stdio.h> #include<conio.h> void main(){ int one, two, multiply; printf("Enter first number - "); scanf("%d",&one); printf("Enter second number - "); scanf("%d",&two); multiply = one * two; printf("The multiplication of numbers %d and %d is %d",one,two,multiply); getch(); } //End of the program.
Output:
Enter first number – 20
Enter second number – 4
The multiplication of numbers 20 and 4 is 80
So this was, the program to multiply two numbers in C.