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 does the message "warning: macro replacement within a string literal" mean?
disadvantages of realloc ?
i want the code for printing the output as follows 4 4 3 3 2 2 1 1 0 1 1 2 2 3 3 4 4
write a “Hello World” program in “c” without using a semicolon?
Can we change the value of #define in c?
How can a number be converted to a string?
EXPLAIN #INCLUDE<STDIO.H> EXPLAIN #INCLUDE<CONIO.H>
What is the most efficient way to store flag values?
prog for 1st five prime numbers in 2^x - 1
What is the difference between far and near ?
how to print 212 as Twohundreds twelve plz provide me ans soon
if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0