Input :-
Output :-
Code :-
#include <stdio.h>
int main()
{
int c, n, fact = 1;
printf("Enter a number \n");
scanf("%d", &n);
for (c = 1; c <= n; c++)
fact = fact * c;
printf("The factorial of %d is = %d\n", n, fact);
return 0;
}
Output :-
Code :-
#include <stdio.h>
int main()
{
int c, n, fact = 1;
printf("Enter a number \n");
scanf("%d", &n);
for (c = 1; c <= n; c++)
fact = fact * c;
printf("The factorial of %d is = %d\n", n, fact);
return 0;
}
0 Comments:
Post a Comment