write a programe to find the factorial of given number
using recursion

Answers were Sorted based on User's Feedback



write a programe to find the factorial of given number using recursion..

Answer / hari

int fact(int n)
{
if(n==1)
return 1;
else
return(n*fact(n-1));
}

for further queries and discussions, just check these out !!!

http://forum.campusmaniac.com/
http://www.campusmaniac.com/

Is This Answer Correct ?    13 Yes 4 No

write a programe to find the factorial of given number using recursion..

Answer / hari.11

t fact(int n)
{
if(n==1)
return 1;
else
return(n*fact(n-1));
}

for further queries and discussions, just check these out !!!

http://forum.campusmaniac.com/
http://www.campusmaniac.com/

Is This Answer Correct ?    2 Yes 2 No

write a programe to find the factorial of given number using recursion..

Answer / jessie

import util.java.Scanner
class factorial
{
public static void main(string arge[])
{
Scanner s=new Scanner(System.in);
int n=new int();
n=s.nextInt();
fact(n);
fact(int n)
{
if(n==1)
return 1;
else
return (n*fact(n-1));
}
System.out.println("the factorial of number is "+n);
}
}

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C Interview Questions

What is structure and union in c?

0 Answers  


What are the scope of static variables?

0 Answers  


If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402

0 Answers  


can we declare a variable in different scopes with different data types? answer in detail

3 Answers   TCS,


Explain the difference between malloc() and calloc() in c?

0 Answers  


What are the types of pointers in c?

0 Answers  


Wt are the Buses in C Language

0 Answers   Infosys,


5) Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors.without using big int and exponential function

1 Answers   TCS,


print ur name without using any semicolon in c/c++....

21 Answers   Bosch, TCS, Wipro,


What is the difference between realloc() and free()

1 Answers  


what are two kinds of java

2 Answers  


code for concatination of 2 strings with out using library functions?

3 Answers  


Categories