|
|
back to boardWhy does my program not work? // USU Problem 1142 // Relation // Done by Teh Ming Han #include <iostream.h> int main(){ int i,n; unsigned long fact[10]; fact[1] = 1; for (i=2;i<=10;i++) fact[i] = fact[i-1]*i;
while (!cin.eof()){ cin>>n; if (n>=1) cout<<(fact[n]*(n-1))+1<<endl; else break; } return 0; } Re: Why does my program not work? Posted by Dilyan 1 May 2005 15:57 the problem is not in your code. your idia is wrong. i looked at your sors. it will only work when there is only one sign '='. Edited by author 01.05.2005 16:01 |
|
|