Question:-Write a program to find factorial of given number.
#include<stdio.h>
#include<conio.h>
void show(int);
void main()
{
int n;
clrscr();
printf("enter the value of n");
scanf("%d",&n);
show(n);
getch();
}
void show(int a)
{int i,fact=1;
for(i=1;i<a;i++)
{
fact=fact*a*i;
}
printf("%d\n",fact);
}
OUTPUT:-
enter the value of n:4
24
Comments
Post a Comment