#include<stdio.h>
#include<conio.h>
void main()
{
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++)
{
printf("%d\t",i);
f=f*i;
}
printf("\n Factoria of %d is %d",n,f);
}
No comments:
Post a Comment
Rahul-Notes