Hi! I have an assignment. A C++ program. But sad to say I dont know how.

-Write a program that multiplies two numbers withou using (*symbol). (Use for loops)

Please help me!

Re: C++ Program 80 80

Can you think of a method that uses addition?

Re: C++ Program 80 80

Post the code which you tried.

Re: C++ Program 80 80

As exponentiation is repeated multiplication, so is multiplication repeated addition. In programming, when you have to do repeated things, you can use a loop structure(e.g. a for loop)

Re: C++ Program 80 80
#include<iostream>
using namespace std;
int main()
{
int n1,n2,holder=0;
cin>>n1>>n2;
for (int i=0;i<n2;i++)
{
holder=holder+n1;

}
cout<<holder<<endl;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.