C Programming
Computer Programming

Program in C to display factorial of an integer using pointer



Write a Program in c to display factorial of an integer using pointer

\* C Program to to display factorial of an integer using pointer *\

# include < stdio.h >
int   main( )
{

int   num, fact=1  ;
int   *pn, *pf  ;
printf(" Enter any Number : ") ;
scanf("%f ", & num) ;

pn = & num  ;
pf = & fact  ;

do
{

*pf = ( *pf ) * ( *pn )  ;
*pn = *pn - 1  ;

}while(  *pn > 0 ) ;
printf("\n Factorial of entred number is : %d ", *pf) ;
return ( 0 );

}

Output of Program :

Output of Program in C to display factorial of an integer using pointer