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

What is a lvalue

668


How main function is called in c?

633


what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)

1932


What happens if a header file is included twice?

602


What is far pointer in c?

815






praagnovation

1780


What is page thrashing?

655


What is the use of header?

628


What does c mean in basketball?

563


The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.

1070


Explain how are 16- and 32-bit numbers stored?

787


What is a struct c#?

603


Is c is a middle level language?

600


What is the difference between text and binary modes?

650


Can a pointer point to null?

594