Course Solutions Uncategorized (Solved) : Code Far S Basic Java Class Purpose Code Prompt User 10 Integers Display Largest Smallest Q31507210 . . . .

(Solved) : Code Far S Basic Java Class Purpose Code Prompt User 10 Integers Display Largest Smallest Q31507210 . . . .

 

This is my code so far and it’s for a basic Java class. Thepurpose for the code is to prompt the user for 10 integers and thendisplay the largest and smallest integer that was inputed. I wasable to ask the user for the 10 integers and display the largestnumber; however, the smallest number isn’t shown. It just displaysthat the smallest integer is 0.

E import java.util.Scanner; public class Largesmall public static void main (String [] args) int counter 1; int largest = 0; int smallest 0; int number0; Scanner input- new Scanner(System.in); while (counter <= 10) { System.out.print (Enter number: ); number -input.nextInt); if (number largest) largest number; Jelse if(numbersmallest) smallestnumber; Jelse System.out.print(Number isnt distinct) countercounter 1; System.out.println(Largest number is: + largest); System.out.println( Smallest number is: smallest);

E

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post