plz answer..... a program that reads non-negative integer
and computes and prints its factorial
Answer Posted / vignesh1988i
USING RECURSION
#include<stdio.h>
#include<conio.h>
int factorial(int);
void main()
{
int n,c;
printf("enter the non negative number :");
scanf("%d",&n);
if(n>=0)
{
c=factorial(n);
printf("the factorial is : %d",c);
}
else
printf("only for non negative numbers factorial can be
computed");
getch();
}
int factorial(int n)
{
static i=1,fact=1;
fact=fact*i;
if(i==5)
return(fact);
else
factorial(++i);
}
iam back thank you
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What is function prototype?
What are types of functions?
What is the difference between array and pointer in c?
What are linked lists in c?
When should a far pointer be used?
hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..
What is console in c language?
Why c is procedure oriented?
praagnovation
Is a house a mass structure?
What is 1f in c?
Combinations of fibanocci prime series
What is selection sort in c?
What is the argument of a function in c?
How many loops are there in c?