write a program that finds the factorial of a number using
recursion?
Answer Posted / sibnath halder
//*write a c program to calculate factorial by using
recursion*//
#include<stdio.h>
void main()
{
int factorial(int);
int n;
printf("Enter a number: ");
scanf("%d",&n);
printf("Factorial of %d is: %d",n,factorial(n));
}
int factorial(int f)
{
int fact;
if(f==1)
return(1);
else
fact=f*factorial(f-1);
return(fact);
}
| Is This Answer Correct ? | 10 Yes | 5 No |
Post New Answer View All Answers
Which header file is used for clrscr?
Explain what is page thrashing?
An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array
i got 75% in all semester am i eligible for your company
Explain the array representation of a binary tree in C.
What is getch() function?
What the different types of arrays in c?
Why is sizeof () an operator and not a function?
what are the facialities provided by you after the selection of the student.
Is c call by value?
What does %d do?
struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer
What is difference between constant pointer and constant variable?
how many errors in c explain deply
What is bubble sort in c?