- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Multiplication of two numbers a and b yields their product. Value of a is added as many times as the value of b to get the product of a and b.

For example.

5 * 4 = 20 7 * 8 = 56 9 * 9 = 81

A program to multiply two numbers using the * operator is given as follows −

#include <iostream> using namespace std; int main() { int a = 6, b = 8; cout<<"Product of "<<a<<" and "<<b<<" is "<<a*b<<endl; return 0; }

Product of 6 and 8 is 48

In the above program, the product of a and b is simply displayed using the * operator. This is demonstrated by the following code snippet.

cout<<"Product of "<<a<<" and "<<b<<" is "<<a*b<<endl;

A program to multiply two numbers without using the * operator is given as follows −

#include<iostream> using namespace std; int main() { int a=7, b=8, product=0; for(int i=1; i<=b; i++) product = product + a; cout<<"The product of "<<a<<" and "<<b<<" is "<<product<<endl; return 0; }

The product of 7 and 8 is 56

In the above program, a for loop is used to add the value of a total of b times. This yields the product of a and b.

This is demonstrated by the following code snippet.

for(int i=1; i<=b; i++) product = product + a;

After this, the product of a and b is displayed. This is shown as follows −

cout<<"The product of "<<a<<" and "<<b<<" is "<<product<<endl;

- Related Questions & Answers
- C Program to Multiply two Floating Point Numbers?
- 8051 Program to Multiply two 8 Bit numbers
- 8085 Program to Multiply two 8 bits numbers
- 8085 program to multiply two 8 bit numbers
- 8086 program to multiply two 8-bit numbers
- 8086 program to multiply two 16-bit numbers
- C# program to multiply two matrices
- 8085 Program to multiply two 2-digit BCD numbers
- 8085 Program to multiply two 16-bit binary numbers
- Fastest Way to multiply two Numbers
- Program to multiply two matrices in C++
- 8085 Program to Multiply two numbers of size 8 bits
- Program to Multiply two 8 Bit numbers in 8051 Microprocessor
- 8085 program to multiply two 8 bit numbers using logical instructions
- Program to multiply two 2-digit BCD numbers in 8085 Microprocessor

Advertisements