write a program that finds the factorial of a number using
recursion?
Answer Posted / inderjeet
#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 ? | 62 Yes | 18 No |
Post New Answer View All Answers
How many types of operator or there in c?
Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.
Explain Function Pointer?
What is structure of c program?
Is there a way to jump out of a function or functions?
What is a node in c?
Write a simple code fragment that will check if a number is positive or negative.
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321
What is %s and %d in c?
The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.
What’s the special use of UNIONS?
What is the meaning of c in c language?
Give me the code of in-order recursive and non-recursive.
Explain the difference between #include "..." And #include <...> In c?
how many key words availabel in c a) 28 b) 31 c) 32