Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 wrong with this statement? Myname = 'robin';

1277


Explain what is a static function?

1062


What's a good way to check for "close enough" floating-point equality?

1106


How can I rethow can I return a sequence of random numbers which dont repeat at all?

1156


Between macros and functions,which is better to use and why?

2131


what are the different storage classes in c?

1131


Can you pass an entire structure to functions?

1086


Mention four important string handling functions in c languages .

1055


Is the exit() function same as the return statement? Explain.

1042


Why clrscr is used after variable declaration?

1638


Why doesnt the call scanf work?

1146


Which control loop is recommended if you have to execute set of statements for fixed number of times?

1306


How can I sort more data than will fit in memory?

1049


Explain how do you generate random numbers in c?

1052


Write a code to determine the total number of stops an elevator would take to serve N number of people.

1207