Factorial | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Factorial

To make a factorial would I need a for or can I do it without?

7th Oct 2016, 7:12 PM
Adrian Bedolla Herrera
Adrian Bedolla Herrera - avatar
1 Answer
0
this is my code #include<iostream> using namespace std; void main (){ int number; int factorial =1; cout<<"please enter the number:"; cin>>number; for(int i=1;i<=number;i++) factorial*=i; cout<<"the factorial of the entered number="; cout<<factorial; }
22nd Oct 2016, 2:36 PM
Rawan Anaya
Rawan Anaya - avatar