#include<stdio.h>
#include<conio.h>
void main()
int n,f=1,i;
clrscr();
printf("\n Enter positive number: ");
scanf("%d",&n);
if(n<0)
printf("\n You have entered negative number");
else if(n==0)
printf("\n Factorial of %d is 1",n);
else
{
for(i=1;i<=n;i++)
f=f*i;
printf("\n Factoria of %d is %d",n,f);
}
No comments:
Post a Comment
Rahul-Notes