Skip to main content

factorial of the given number

Factorial of the given number

This is the program for find the factorial of the given number
Now you think given number is 5.


#include<stdio.h>
#include<string.h>
int fac(int a);
int main()
{
int fact;

fact = fac(5);
printf("factorials of 5 is %d",fact);

}

int fac(int a)
{
if(a<=1)
{
return 1;
}
else
{
a=a*fac(a-1);
return a;
}
}

Comments

Popular posts from this blog

CAN INTERVIEW QUESTIONS

Qualifiers and Modifier in C

RTOS Real time operating system interview questions

CAN INTERVIEW QUESTIONS 2

What is UDS protocol

Memory mapping in c

TOP IOT PLATFORMS