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
List the difference between a "copy constructor" and a "assignment operator"?
What is static identifier?
What is the size of array float a(10)?
What is a rvalue?
What are the advantages of c language?
What are type modifiers in c?
By using C language input a date into it and if it is right?
What is the difference between printf and scanf )?
What is a null pointer in c?
What is the purpose of & in scanf?
What is define c?
What does c value mean?
What should malloc(0) do?
what will be maximum number of comparisons when number of elements are given?
Where is c used?