In this video tutorial you can learn the procedure followed in C programming to multiply two numbers.
Related Read:
#include < stdio.h > int main() { int a, b, c; printf("Enter 2 numbers for multiplication\n"); scanf("%d %d", &a, &b); c = a * b; printf("Multiplication of %d and %d is %d\n", a, b, c); return 0; }
Output:
Enter 2 numbers for multiplication
25
5
Multiplication of 25 and 5 is 125
You can write same program without using third variable to calculate multiplication of 2 numbers, as below:
#include < stdio.h > int main() { int a, b; printf("Enter 2 numbers for multiplication\n"); scanf("%d %d", &a, &b); printf("Multiplication of %d and %d is %d\n", a, b, (a*b)); return 0; }
Output:
Enter 2 numbers for multiplication
25
5
Multiplication of 25 and 5 is 125
Note: Instead of int you can take float variables too. That would help in taking both integer as well as real values from the user as input.
In above c program we are asking user to enter the values for variable a and b. You can know more about scanf() method/function in this video tutorial: Using Scanf in C Program
Multiplication of Two Numbers: C Programming
This video was produced as building block for our simple calculator application.
For full C programming language free video tutorial list visit:C Programming: Beginner To Advance To Expert