write a programe to find the factorial of given number
using recursion
Answer Posted / 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 View All Answers
What is wrong with this statement? Myname = 'robin';
Explain what is a static function?
What's a good way to check for "close enough" floating-point equality?
How can I rethow can I return a sequence of random numbers which dont repeat at all?
Between macros and functions,which is better to use and why?
what are the different storage classes in c?
Can you pass an entire structure to functions?
Mention four important string handling functions in c languages .
Is the exit() function same as the return statement? Explain.
Why clrscr is used after variable declaration?
Why doesnt the call scanf work?
Which control loop is recommended if you have to execute set of statements for fixed number of times?
How can I sort more data than will fit in memory?
Explain how do you generate random numbers in c?
Write a code to determine the total number of stops an elevator would take to serve N number of people.