Wednesday, 29 October 2014

Factorial of a number



 Factorial of a number




/*WAP to find the factorial of a given number*/

#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,s=1;
clrscr();
printf("enter the number:");
scanf("%d",&n);
for(i=1;i<=n;i++)
s=s*i;
printf("%d!=%d",n,s);
getch();
}

OUTPUT:
enter the number:6

6!=720

No comments:

Post a Comment