#include"stdafx.h"
#include"iostream"
usingnamespace std;
void main()
{
int outer, num, fact, total;
cout <<"What factorial do you want to see? "<<endl;
cin >> num;
for (outer=1; outer <= num; outer++)
{
total = 1;
for (fact=1; fact<= outer; fact++)
{ total *= fact; }
}cout <<"The factorial for "<< num <<" is "<< total<<endl;
system("pause");
}
No comments:
Post a Comment