for loop with counter value

In the following code, a user will input a number (number must be greater than 2) and will create a running multiple total. The counter should stop at the user defined total (a number greater than 2) but when I run the program, it just keeps asking to enter a number and never generates the total.

#include <iostream>
using namespace std;

int main ()
{
int number, counter = 1;
double mul = 1;


cout << "How many numbers do you want to enter? ";
cin >> number;

while (number <=1)
{
cout << "You must have atleast two numbers for a product. "<<endl<<endl;
cout << "How many numbers do you want to enter? ";
cin >> number;
}

for (number >= 2; counter = number; counter ++)
{
cout <<"Please enter a number. ";

cin >> number;

mul *=number;

}

cout << "The product of the <<number<< numbers is " <<mul<< " ." <<endl;

}


I need help what to assign in

for (number >= 2; counter = NUMBER; counter ++)

The error is coming in at NUMBER and I cant figure it out.
your assigning the value of number to counter not checking to see if it equals it. use counter==number instead
try while loop, it may be very simple

1
2
3
4
5
while(number >= 2)
{
     mul *=number;
     number--;
}


NOTE: it will display the factorial of the number
Topic archived. No new replies allowed.