Define function in C. Write a program to calculate factorial of a given number using function.

Shra Wan
0
Define function in C. 

Answer this question in comment plzzz....


Write a program to calculate factorial of a given number using function. 

#include<stdio.h>
void fact (void);
int main( )
{
fact( );
return0;
} 
void fact( )
{
int n, i, f=1;
printf(“Enter any number”);
scanf(“%d”, &n);
for(i=1; i<=n; I++)
{
	f=f*i;
}
printf(“Factorial is %d”, f);
}

Post a Comment

0Comments

Thank you very much for your comment.

Post a Comment (0)