Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a) I need to write a program that asks the user for a positive nonzero integer v

ID: 3629079 • Letter: A

Question

a) I need to write a program that asks the user for a positive nonzero integer value. The program should use a loop to calculate the product of all the integers from 1 up to the number entered. For example, if the user enters 5, the loop will find the result for 1x2x3x4x5.


b) create a program with a loop that lets the user enter a series of integers. The user should enter -99 to signal the end of the series. After all the numbers have been entered, the program should display the largest and smallest numbers entered.

Explanation / Answer

For the first question ....here is the program.....which is also know as to display factorial of the no: import java.io.*; class Factorial{ public static void main(String[] args) { try{ BufferedReader object = new BufferedReader(new InputStreamReader(System.in)); System.out.println("enter the number"); int a= Integer.parseInt(object.readLine()); int fact= 1; System.out.println("Factorial of " +a+ ":"); for (int i= 1; i max ? input : max; min = input