Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program with a loop that lets the user enter a series of integers. The user should enter 99 to signal the end of

Write 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 pro-gram should display the largest and smallest numbers entered. program is in JAVA.

please help me check my program. The output for largest value shown below is not correct.

public static void main(String[] args) { Scanner input = new Scanner(System.in); int value; int smallest; int largest = 0; System.out.println("Instructions: if you would like to stop, enter -99"); System.out.print("Enter a number: "); value = input.nextInt(); smallest = value; while(value != -99){ System.out.print("Enter a number: "); value = input.nextInt(); if(value!=-99) { if (value > largest){ largest = value; } if (value

OUTPUT:

Instructions: if you would like to stop, enter -99 Enter a number: 100 Enter a number: 88 Enter a number: 7 Enter a number: 98 Enter a number: -99 Smallest Value: 7 Largest Value: 98

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions