C Programming

Program to Calculate Factorial Using Static Storage Class.

#include<stdio.h>
#include<conio.h>
void main()
{
int x,i;
long int f;
long int factstat(int i);
printf(“Input number:”);
scanf(“%d”,&x)
for(i=1; i<=x; i++)
f=factstat(i);
printf(“n Factorial=%d”,f);
}
long int factstat(int i)
{
static long int f=1;
f*=i;
return(f);
}

Related Articles

Back to top button

Adblock Detected

Please turn off your Adblocker to view your content.