Multiply without using * Operator

Folks,

Here is another program from the series tricky code. Here I am going to show you how we can do Multiplication without using Multiply Operator *. You will rarely get this kind of programs.

Comment below to express your feeling and suggest me a new idea for more tricky code.

Logic of the code:

First you give a try to think the logic.

Code:

//C Program for Multiplication without Using Multiply Operator *

‪#‎include‬<iostream.h>

#include<conio.h>
void main()
{
int n, m, s=0;
clrscr();
cout <<"Enter the values";
cin>>n>>m;
while(m!=0)
{
s=s+n;
m--;
}
cout <<"Result = "<<s;
getch();
}


Here is the answer,

Let a and b be two variables then c=a*b. We take 9 as a and 8 as b then c=72.

In other word we are adding 9, 8 times or adding 9, 8 times, so simple logic.

This is what I converted into program.

Submit your own source code in the 'Contact Us' page or else herein the comment box of this post.

-Chief Administrative Officer.

Share this

Related Posts

Dear User,

Thank you for your comment. Hope you like this blog. Kindly share us on Social Media so others can be updated.

-Chief Administrative Officer.