write a program that finds the factorial of a number using
recursion?
Answer Posted / bala c king
#include<stdio.h>
#include<conio.h>
void main()
{
int factorial(int);
int n;
clrscr();
printf("Enter a number: ");
scanf("%d",&n);
printf("Factorial of %d is: %d",n,factorial(n));
getch();
}
int factorial(int f)
{
int fact;
if(f==1)
return(1);
else
fact=f*factorial(f-1);
return(fact);
}
| Is This Answer Correct ? | 35 Yes | 14 No |
Post New Answer View All Answers
If i have an array 0 to 99 i.e,(Size 100) I place the values 1 to 100 randomly like a[0]=29,a[1]=56 upto array[99].. the values are only between 1 to 100. getting the array values by using scanf.. If i entered one wrong element value line a[56]=108. how can i find it.. and also how to find the missing value in 1 to 100.. and i want to replace the missing values.. any one of them know please post your answer..
how should functions be apportioned among source files?
How to establish connection with oracle database software from c language?
main() { printf("hello"); fork(); }
What is cohesion and coupling in c?
What is calloc in c?
What are type modifiers in c?
What are dangling pointers in c?
What is indirection in c?
What does printf does?
What is the purpose of main() function?
What is double pointer?
the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function
what is different between auto and local static? why should we use local static?
Explain the bubble sort algorithm.