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 many types of operator or there in c?
What is union and structure in c?
How can a program be made to print the name of a source file where an error occurs?
Tell me what is null pointer in c?
How to explain the final year project as a fresher please answer with sample project
What are the functions to open and close the file in c language?
What is the size of structure pointer in c?
How is null defined in c?
What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers
c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above
What is a structural principle?
In c programming, explain how do you insert quote characters (? And ?) Into the output screen?
Can you define which header file to include at compile time?
Is register a keyword in c?
Tell me is null always defined as 0(zero)?