Friday, 15 June 2018

Program to find factorial of a number by using user define function in C

/* function prototype */
# include <stdio.h>
int fact (int) ;
void main ()
{
int a,b ;
clrscr () ;
printf ("\n enter the value of a:") ;
scanf ("%d", & a) ;
b = factorial(a) ;
getch () ;
}
int factorial (int a)
{
int fact = 1 ;
while (a!=0)
{
fact=fact*a ;
a-- ;
}
getch ;
}


No comments:

Post a Comment

Featured post

Kalgudi Interview Round!!

Those who cleared the second round of kalgudi got an email from exceller to complete their Kalgudi Interview Round. So here we will discuss ...