#include <iostream>
#include <cmath>
usingnamespace std;
int main()
{
int i;
int z;
int x;
for (i = 1; i< 10; i++)
{
x = 2;
z = i * x;
x++;
cout<< z<< endl;
}
system ("pause");
return 0;
}
what i am trying to do is this: Write a program to generate the product of the numbers in the range [1, 10).
my problem is that x++ is not working for some reason and also z should be (1*2*3*4*5*6*7*8*9)
but i dont how to do that
what i need for the program to do is multiply 1*2*3*4*5*6*7*8*9 =z
but my program overrides the z value and doesnt save it anywhere so i end up with getting all the values differently but i just need 1 answer
by using the = operator z is getting a new value each time. what *= does is multiply z by the value on the other side of the = sign. these two statements are equivalent