+ 1

I did not find the error in the code they allways give me factorial=0

https://code.sololearn.com/cZEdgP3SHdPR/?ref=app #include <cstdlib> #include <iostream> using namespace std; main() { int nembre,fact,a; cout<< "donner la valeur du Nembre N = "; cin >> nembre; if (nembre==0) { cout<< "le factorial est = 1"; } else { fact=1; while (a<=nembre) { fact=fact*(a); a=a+1; } cout << "le factorial est = " <<fact <<endl; } }

16th Nov 2019, 5:37 PM
Kellouche Dhiya
Kellouche Dhiya - avatar
1 Odpowiedź
+ 3
The main() function must have „int“ as return type: int main()
16th Nov 2019, 5:44 PM
Michael
Michael - avatar