Why this code go wrong?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
29th Apr 2018, 3:26 PM
mostafa alhussieni
3 Answers
+ 2
Your code has many errors, i guess this is what you wanted to do: https://code.sololearn.com/c48vb94aBIXM/?ref=app
29th Apr 2018, 4:36 PM
David Escalante
David Escalante - avatar
+ 1
#include <iostream> using namespace std; int fact(int); //protype int main() { int n; cout<<"enter value n = "; cin>>n; cout<<n; int factorial=fact(n); //you miss some semicolons cout<<"factorial = "<<factorial<<endl; return 0; }; //and this semicolons too. int fact(int n) //you have to indicate the value you send to the function { int i,f=1; for(i=1;i<=n;i++) f=f*i; return f; //this is the value you need to optain from the function. };
5th May 2018, 11:13 PM
Claudia Santana Verdecia
Claudia Santana Verdecia - avatar
0
great
8th Aug 2018, 6:59 PM
Mahmoud Refaat
Mahmoud Refaat - avatar