#include
using namespace std;
int multiply(int a, int b){
if (b == 1){
return a;
}
return a + (a*(b-1));
}
int main(){
int a, b;
cin >> a >> b;
cout << multiply(a, b);
return 0;
}
#include
using namespace std;
int multiply(int a, int b){
if (b == 1){
return a;
}
return a + (a*(b-1));
}
int main(){
int a, b;
cin >> a >> b;
cout << multiply(a, b);
return 0;
}
hello @udatta
* is needed for this probem…
if u dont want to use * then u have to write another function that will find multiplication by perfoming addition that many times
But is has been mentioned that we have to do without using *.
Like in both the cases we have to use ‘*’. Right?
…
no if we have to compute ab then we can add a , b times to get ab
Exactly so how will I code that thing I am getting confused in that
first create a function that computes A*B without * .
then use this function whenevr u are to compute multiplication of two numbers
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.