hi guys im writing a code to compute a factorial and when i enter the number, it skips a line and the program doesn't do anything. help please
#include <iostream>
using namespace std;
int main()
{
string in;
int factorial,num,count;
cout << "Enter a number:" << endl;
cin >> num;
factorial=1;
while (cin >= 0)
for(count=1;count<num;count++)
{
factorial=factorial*count;
}
cout << endl;
cout << "The factorial of " << num << " is " << factorial;
return 0;
}
while (cin >= 0)
What is this doing here?
replace while loop with while(num>=0)