Write a recursive method to compute the factorial of a number.

What will be an ideal response?


```
public static int factorial(int n)
{
if(n < 0)
{
System.out.println(“Sorry negative numbers not allowed.”);
System.exit(0);
}
if(n == 1) //base case
return(1);
else
return (n * factorial(n-1));
}

```

Computer Science & Information Technology

You might also like to view...

Satellites that orbit at the same speed of the earth’s rotation, and allow for a dish to be aimed at a fixed location, are known as

a. LEO satellites b. MEO satellites c. GEO satellites d. none of the above

Computer Science & Information Technology

Computer interaction that responds to your actions; for example by presenting text, graphics, animation, video, audio, or games

a. interactive media b. moving graphics c. SmartArt

Computer Science & Information Technology

Explain the importance of including an Alt Text title and description for a chart.

What will be an ideal response?

Computer Science & Information Technology

The ____ list might contain icons for websites visited several weeks ago, last week, and every day of the current week, including today, depending on your settings.

A. Instant Search box B. Address C. Recent Pages D. History

Computer Science & Information Technology