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 structure and union in c?
What are the scope of static variables?
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
can we declare a variable in different scopes with different data types? answer in detail
Explain the difference between malloc() and calloc() in c?
What are the types of pointers in c?
Wt are the Buses in C Language
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
print ur name without using any semicolon in c/c++....
21 Answers Bosch, TCS, Wipro,
What is the difference between realloc() and free()
what are two kinds of java
code for concatination of 2 strings with out using library functions?