- 1
Why this code doesn’t work ?(factorial)
What is problem with this code(factorial) https://code.sololearn.com/cb3y5047086H/?ref=app #include <iostream> using namespace std; int f(int a,int i) { int a; for(i=1;i<a;i++) a =a*i; return a; } int main() { int a,i; cin>>a; f(a,i); cout<<f(a,i); }
2 ответов
+ 1
Amirhossein Omidi yekta you have duplicate questions?also you should learn the basic syntax or atleast learn to read the errors or you won't be able to understand anything as can be seen from the mistakes in this code:-)
0
You are not initialising i. You don't have to pass it to the function. You can just pass the a value.