1: #include<stdio.h>
2: #include<conio.h>
3: void main()
4: {
5: int n,i,fact;
6: clrscr();
7: printf("Insert the num :");
8: scanf("%d",&n);
9: fact=1;
10: i=1;
11: if(n>=2)
12: for(i=1;i<=n;i++)
13: {
14: fact=i*fact;
15: }
16: printf("the factorial of %d is: %d",n,fact);
17: getch();
18: }
No comments:
Post a Comment