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
Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?
Explain what is a 'locale'?
Find MAXIMUM of three distinct integers using a single C statement
Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.
What does dm mean sexually?
What are register variables in c?
What is the difference between int main and void main?
please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code
What is the difference between volatile and const volatile?
how to make a scientific calculater ?
How can I determine whether a machines byte order is big-endian or little-endian?
simple program of graphics and their output display
Explain how can you restore a redirected standard stream?
Differentiate call by value and call by reference?
What will be the outcome of the following conditional statement if the value of variable s is 10?