Question: Design a program that takes in an integer as input and outputs the factorial of that integer. If the integer is less than 0, output

 Design a program that takes in an integer as input and

Design a program that takes in an integer as input and outputs the factorial of that integer. If the integer is less than 0, output the word "Error". For example: Input: 4 Output: 24 287956.1731522 LAB ACTIVITY 13.6.1: Factorial 0/4 LabProgram.java Load default template... 1 import java.util.Scanner; 2 3 public class LabProgram { 4 public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int num = scnr.nextInt(); 6 7 " 8 9 19 //STEP 1: Check to see if the integer provided is valid (greater than or equal to 6) If the number isn't valid, output an error. //STEP 2: If the number is valid, use a loop to calculate the factorial. Then, print out the factorial. 11 12 13 14 15 } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!