Write a program to find the factorial value of any numberentered through the keyboard.
Solution Code
#include<stdio.h>
int main()
{
int x,j,i;
printf("Enter any number = ");
scanf("%d",&x);
i = 1;
j = 1;
while(i<=x)
{
j=j*i;
i=i+1;
}
printf("Answer = %d \n",j);
system("pause");
return 0;
}
No comments :
Post a Comment
Note: Only a member of this blog may post a comment.