English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

how do u write aprogram to display a name with out using semicolon?and also how to write a program to find a factorial of a number' n' where 'n' is input by the user?

2006-08-09 22:33:34 · 6 answers · asked by Anonymous in Computers & Internet Programming & Design

thanx Nestor for answering this quest but i understood only little:) actually iam a beginner. i am learning it now ............
and is there any site where i can get any hint regarding finding solution.

2006-08-09 23:30:39 · update #1

6 answers

public class Factorial {

// return n!
// precondition: n >= 0 and n <= 20
public static long factorial(long n) {
if (n < 0) throw new RuntimeException("Underflow error in factorial");
else if (n > 20) throw new RuntimeException("Overflow error in factorial");
else if (n == 0) return 1;
else return n * factorial(n-1);
}

public static void main(String[] args) {
long N = Long.parseLong(args[0]);
System.out.println(factorial(N));
}

}

2006-08-09 22:59:52 · answer #1 · answered by Nestor 4 · 0 0

for the latter you have a simple function within the formulae in excel

2006-08-10 06:01:57 · answer #2 · answered by cerebral_orgasm 4 · 0 0

i will help u but first u help me

2006-08-10 06:03:51 · answer #3 · answered by mannu s 1 · 0 0

ask only question...

don't write story... ok

2006-08-10 05:52:16 · answer #4 · answered by patriot_raj 2 · 0 0

simple

void main()
{
if ( printf("your name") )
{ }
}

// done

2006-08-12 02:18:31 · answer #5 · answered by ccsCoder 3 · 0 0

?

2006-08-10 05:44:31 · answer #6 · answered by shamanam 2 · 0 0

fedest.com, questions and answers