Write A Program To Find Factorial Of Given Number Using Recursive Function

Write A Program To Find Factorial Of Given Number Using Recursive Function

M3-R4 O-Level Jan-20 Subjective Programming Based Question 8 (A)

M3-R4 : PROGRAMMING & PROBLEM SOLVING
THROUGH ‘C’ LANGUAGE

PART-1


Note: To read about 

M3 R4 O-Level Jan-20 MCQ

https://learncomputerpci.blogspot.com/2020/07/m3-r4-o-level-jan-20-mcq-with-answers.html

M3 R4 O-Level Jan-20 TRUE OR FALSE

https://learncomputerpci.blogspot.com/2020/07/m3-r4-o-leveljan-20-true-or-false-m3.html

M3 R4 O-Level Jan-20 MATCH THE FOLLOWING

https://learncomputerpci.blogspot.com/2020/07/m3-r4-o-leveljan-20-match-following-m3.html

M3 R4 O-Level Jan-20 FILL IN THE BLANKS

https://learncomputerpci.blogspot.com/2020/07/m3-r4-o-level-jan-20-fill-in-blanks.html


 /*Write a program to find factorial of given number using recursive function*/

#include<stdio.h>

#include<conio.h>

int fact(int); /* Function Prototype */

void main()

 {

  int num,res;

  clrscr();

  printf("Enter a number");

  scanf("%d",&num);

  res=fact(num);  /*Function Calling */

  printf("Factorial of %d is %d",num,res);

  getch();

 }

int fact(int n) /*Function Definition */

 {

  if(n==1)

   return 1; /* Terminating Step */

  else

   return n*fact(n-1); /*Recursive step */

 }

Program Screenshot

Factorial Using Recursion in C

Output Screenshot




Popular posts from this blog

IGNOU Solved Assignment 2023-24 | BCS-012 Basic Mathematics BCA(I)012/Assignment/2023-24

MCS-051 : ADVANCED INTERNET TECHNOLOGIES | 1. (a) Write a web application using JSP and JDBC that takes a bank account number as input and displays the account balance.

MCS054 TEE June 2021 Q1(b) | Bisection Method