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
What are the types of functions in c?
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
How do you determine a file’s attributes?
Is null equal to 0 in sql?
what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)
How is pointer initialized in c?
What is the collection of communication lines and routers called?
Write a C program to count the number of email on text
What are the uses of a pointer?
Why enum is used in c?
What is memcpy() function?
Write a code to determine the total number of stops an elevator would take to serve N number of people.
How can I dynamically allocate arrays?
What is echo in c programming?
When should volatile modifier be used?