A number is taken from user and its factorial is given.
Select To use this code as it is.. select and copy paste this code into code.cpp file :)
- #include<iostream.h>
- #include<conio.h>
- void main()
- {
- clrscr();
- int n,fac=1;
- cout<<"Please enter a number: ";
- cin>>n;
- //Coding by: Snehil Khanor
- //http://WapCPP.blogspot.com
- for (int i=1;i<=n;i++)
- fac=fac*i;
- cout<<fac;
- getch();
- }
0 comments:
Post a Comment