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


Please Help Members By Posting Answers For Below Questions

How many types of operator or there in c?

593


What is union and structure in c?

604


How can a program be made to print the name of a source file where an error occurs?

721


Tell me what is null pointer in c?

601


How to explain the final year project as a fresher please answer with sample project

459






What are the functions to open and close the file in c language?

585


What is the size of structure pointer in c?

603


How is null defined in c?

643


What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers

667


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

722


What is a structural principle?

632


In c programming, explain how do you insert quote characters (? And ?) Into the output screen?

755


Can you define which header file to include at compile time?

573


Is register a keyword in c?

623


Tell me is null always defined as 0(zero)?

664