Hello can you please help me find the error.......it is a program to find the factorial of a number. | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

Hello can you please help me find the error.......it is a program to find the factorial of a number.

#include<iostream> using namespace std; int main() { int num,factorial =1; cout<<"Enter a number to find it's factorial :"; cin>>num; for(int x=1;x<=num;x+++) { factorial=factorial*x; } cout<<"The factorial of the number is :"<<factorial<<endl; return 0;

3rd Sep 2020, 9:12 AM
Vincent Kimanthi
Vincent Kimanthi - avatar
1 Réponse
+ 1
Last line: close missing curly bracket In for loop: Increment statement you put x+++ instead of x++
3rd Sep 2020, 9:18 AM
Vadivelan