//Formula for factorial is : num = num*i; #include<iostream.h> #include<conio.h> void main() { int a,i,fact=1; clrscr(); cout<<"Enter any Number to calculate factorial \n" ; cin>>a; for(i=1;i<n;i++) { fact=fact*i; } cout<<n<<"!= "<<fact; getch(); }
Learn something about IT