top of page

A C program that will find factorial of number using recursion

  • Writer: Nelson John
    Nelson John
  • Nov 26, 2017
  • 1 min read

#include<stdio.h>

#include<conio.h>

int fact(int);

int main() {

int factorial, num;

printf("Enter the value of num :");

scanf("%d", &num);

factorial = fact(num);

printf("Factorial is %d", factorial);

return (0);

}

int fact(int n) {

if (n == 0) {

return (1);

}

return (n * fact(n - 1));

}

Facebook: ayamnelrodinho1@gmail.com

Yahoo: talk2nelsonjohn2dat@yahoo.com

Whatsapp: +2349034595610

PLEASE KINDLY SHARE WITH FELLOW PROGRAMMERS AND ALSO SUBSCRIBE TO MY BLOG PAGE FOR MORE FEEDS.


 
 
 

Comments


bottom of page