write a programe to find the factorial of given number
using recursion
Answers were Sorted based on User's Feedback
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 |
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 |
What is the function of volatile in c language?
Write a C program that computes the value ex by using the formula ex =1+x/1!+x2/2!+x3+3!+………….
Why is c called c?
Can stdout be forced to print somewhere other than the screen?
What is a structure and why it is used?
Explain what are linked list?
What is maximum size of array in c?
User define function contain thier own address or not.
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.
what is the difference between embedded c and turbo c ?
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 ?
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)