Computer Science, asked by adityasharma4642, 1 year ago

Write a program in java to accept numbers from the user till the time user enters N. Print the highest and the lowest number and also print count of the numbers.(using while loop)​

Answers

Answered by GeN21
1

Answer:

import java.util.*;

class Count

{

public static void main( )

{

Scanner I= new Scanner( System. in)

int highest=0;

int lowest=9999999;

int count=0;

String input;

System.out. println ("Enter value");

input=I. nextLine ( );

while( input. compareTo ("N")!=0)

{

int ch= Integer. parseInt (input);

if(ch> highest)

highest=ch;

else if(ch< lowest)

lowest=ch;

count++;

}

System.out. println(highest);

System.out.println(lowest);

System.out.println(count);

}

}

Similar questions