#include<stdio.h>
#include<conio.h>
void main(){
int n,i,fact=1;
printf("Enter a positive integer number\n");
scanf("%d",&n);
if (n>0) {
for (i=1;i<=n;i++) fact=fact*i;
printf("factorial of %d=%d\n",n,fact);
}
else printf("wrong input\n");
getch();
}
No comments:
Post a Comment