error in 14 line ; expected int rec( int a) ^ how to resolve this.please correct the code.

import java.io.*; class Fact {

public static void main(String[]arg)throws IOException {

BufferedReader br=new BufferedReader(new

InputStreamReader(System.in)); System.out.println(?enter number?); int x=Integer.parseInt(br.readLine());

int result=rec(x); System.out.println(result); int rec(int a) {

if(a==1) return(1);

else

return a*rec(a-1);

} } }

View Answers

Ads

Related Tutorials/Questions & Answers:

find factorial of any number using recursion error in 14 line ; expected int rec( int a) ^ how to resolve this.please correct the code. import...)); System.out.println(?enter number?); int x=Integer.parseInt(br.readLine()); int result

Write a program to find a factorial in any given number This programming tutorial will teach you how to write a factorial of any given number... the factorial of any given number import java.util.Scanner; class

Advertisements

Calculate factorial Using Recursion ... by using recursion in jsp. To make a program on factorial, firstly it must... a program on factorial by using recursion in jsp we are going to design a html page

Program to Find Cube Root of any Number without using built in function Please help me in finding cube root of any number without using Built in function in java

program to calculate factorial of any given number. First of all define a class... Factorial Examples - Java Factorial Example to calculate factorial of any... the factorial of number in double which is lies in the range of double data type

java program to check whether a number is pallindrome or not using recursion??????? java program to check whether a number is pallindrome or not using recursion

java program to check whether a number is pallindrome or not using recursion??????? java program to check whether a number is pallindrome or not using recursion

java program to check whether a number is pallindrome or not using recursion??????? java program to check whether a number is pallindrome or not using recursion

java program to check whether a number is pallindrome or not using recursion??????? java program to check whether a number is pallindrome or not using recursion

java program to check whether a number is pallindrome or not using recursion??????? java program to check whether a number is pallindrome or not using recursion

java program to check whether a number is pallindrome or not using recursion??????? java program to check whether a number is pallindrome or not using recursion

java program to check whether a number is pallindrome or not using recursion??????? java program to check whether a number is pallindrome or not using recursion

find the factorial how to find the factorial through the while loop...) { int value = 5, factorial = 1, temp = value; while (temp > 0) { factorial *= temp; temp

factorial using recursive can please give this code !i am going to do a factorial function using recursion definition and then . my professor told... an MAIN MENU then above that RECURSION below that again the EXIT BUTTON

are going to find out the factorial of 12 by using the while loop. In while loop... used to write the content on the browser. We can find a factorial of a number...Finding a Factorial using while loop

Calculate factorial of a number. How to calculate factorial...("Please Input Any Number"); int num = 0; BufferedReader br = new...; } System.out.println(result); } } Description: - Factorial of any

find a factorial of a number by using the temp variable which will help us...Finding a Factorial using while loop In this example we are going to find out the factorial of 12 by using

program on factorial of a given number in java please tell me, how to write program on factorial of a given number in java

program on factorial of a given number in java please tell me, how to write program on factorial of a given number in java

print square of any number using c++ language, write aprogram to print the square of any number entered by the user

how to find a square root of any number without using math.sqrt() method... for finding square root of any number without using system methods. Square root... to find out the square root of any number by calling math.sqrt() method. You

alot for a function in mysql to find factorial numbers of a number and couldn't find any. What I want to achieve is to find the prime numbers composing an integer...How to get factorial in mysql Hi, In order to improve the speed

Find out the prime number ... to find out whether a given number is prime or not. Here we have used the 'for loop... factorial other than 1 and the number itself. Here, first make a class

using random number generate a 10 digit number using random number and display the length of longest increasing series

How to find java jobs at any where in india Hi, I want information about java related jobs in india.where can i find that details

using random number generate 10 number and display the length of longest incresing series

using random number generate 10 digit number and display the length of longest incresing swries

Factorial program in Java helps programmer to write factors of any given integer number. In the following example, a class by the name "Factorial1" is used... the number 5 Factorial of 5: 120.0

Midpoint of two number While solving any mathematical problem it becomes important to find the number that is exactly between two numbers. In this example

factorial of fibonacci A code for the factorial of a fibonacci series. Example when the user enters 6, the fibonacci series is 8 and the factorial will be 8! or 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1. So if the user enters the number 6

A program to find the sum of odd number In this section you will learn how to find the sum of odd number in the series up to the given number in java... the console. Now here is the simple example which will help you to find the sum of odd