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 the function of volatile in c language?

0 Answers  


Write a C program that computes the value ex by using the formula ex =1+x/1!+x2/2!+x3+3!+………….

1 Answers  


Why is c called c?

0 Answers  


Can stdout be forced to print somewhere other than the screen?

0 Answers  


What is a structure and why it is used?

0 Answers   Hexaware,


Explain what are linked list?

0 Answers  


What is maximum size of array in c?

0 Answers  


User define function contain thier own address or not.

2 Answers  


How do we select the big element or any other operation from array which is read dynamically. user need to give the elements only no need to mention the size.

0 Answers  


what is the difference between embedded c and turbo c ?

1 Answers  


what is difference between userlevel threads and kernel level threads ?what are the trades offs between these two approaches ? what approach is most frequently used and why ?

1 Answers  


In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)

0 Answers   Wipro,


Categories