Need help writing a program for multiplication with for loops only

I am trying to write a code that will do multiplication with for loops using ++ and -- functions only and when I run the program it returns me with the n1 value I entered no the final product I was wondering what I was doing wrong?

int choice, n1, n2;
int temp=n1;
cout<<"Enter Two Numbers"<< endl;
cin>> n1;
cin>> n2;
for (int i=0;i<n2-1;i++)
{

for (int k=0;k<temp;k++)
{
n1++;

}
}
cout<<"The result is "<<n1<< endl;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>                   // For stream input/output

int main()
{
    int n1, n2 ;
    std::cout << "enter two numbers: " ;
    std::cin >> n1 >> n2 ;

    std::cout << n1 << " * " << n2 << " == " ;

    // if either n1 or n2 is zero, the result is zero
    if( n1==0 || n2==0 ) std::cout << "0\n" ;

    else
    {
        // if one is negative and the other is positive, the result is negative
        const bool negative_result = ( n1<0 && n2>0 ) || ( n1>0 && n2<0 ) ;

        // now that we know the sign of the result, make both positive
        if( n1 < 0 ) n1 = -n1 ;
        if( n2 < 0 ) n2 = -n2 ;

        // compute the product by using ++
        int result = 0 ;
        for( int i = 0 ; i < n2 ; ++i ) // n2 times
            for( int j = 0 ; j < n1 ; ++j ) ++result ; // increment n1 times
        // note: ++result in the inner loop will executes n1*n2 times in all
        // note: we assume that the product n1*n2 is within the range of int

        // if the result should be negative, make it negative
        if(negative_result) result = -result ;

        // and then print the result    '
        std::cout << result << '\n' ;
    }
}
Thank you so much for the help it worked.
Topic archived. No new replies allowed.