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
How do you sort filenames in a directory?
Why do we use header files in c?
What are qualifiers and modifiers c?
i have a written test for microland please give me test pattern
What is a nested formula?
Stimulate calculator using Switch-case-default statement for two numbers
why we wont use '&' sing in aceesing the string using scanf
Where define directive used?
How can I swap two values without using a temporary?
How can a number be converted to a string?
What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25
What is the purpose of & in scanf?
Explain which function in c can be used to append a string to another string?
Why calloc is better than malloc?
What is variables in c?