C Program Code for Factorial of a Number in a Given Range

Program Code:

#include<stdio.h>
int main()
{
int fact =1 ,n , i ,j;
printf("Enter Range A :  ");
scanf("%d",&n);
printf("\n\n");
printf("A\t\tFactorial A\n\n");
    for(i =1;i<n;i++)
{
for(j=1;j<=i;j++)
{
fact = fact * j;
}
printf("%d",i,"\t\t",fact);
printf("\n");
fact = 1;
}
return 0;
}

Output:

.exe file

No comments:

Post a Comment

Please disable your ad blocker to support this website.

Our website relies on revenue from ads to keep providing free content.