mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-06 08:46:53 +08:00
Create factorial.cpp
This commit is contained in:
parent
236d94df49
commit
b7b76ad8b4
13
samples/factorial.cpp
Normal file
13
samples/factorial.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int i,fact=1,number;
|
||||
cout<<"Enter any Number: ";
|
||||
cin>>number;
|
||||
for(i=1;i<=number;i++){
|
||||
fact=fact*i;
|
||||
}
|
||||
cout<<"Factorial of " <<number<<" is: "<<fact<<endl;
|
||||
return 0;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user