Assignment Problem

I have an assignment for school that says the following:

"Write a program that executes multiplication of two integers entered by the user, by using ONLY the addition operation. So, for example if the inputs are 3 and 4, the program will execute 3 times addition of 4: 4+4+4."

The issue I have run into is that I need one less "+" than number, for the output.(I am using a for loop by the way) For example: for 3 * 4, the output must be 3+3+3+3=12 but I keep getting 3+3+3+3+=12
Please help!
Could you post the code or part of the code that you are having a problem with?
1
2
3
4
5
6
7
void f(unsigned x, unsigned n){
    for(unsigned i=0; i<n; i++){
        cout<<x;
        if(i+1!=n) cout<<'+';
    }
    cout<<'='<<(x*n)<<'\n';
}
Topic archived. No new replies allowed.