Largest of five (5 points). Write an algorithm that read 5 distinct integers and displays the largest value. Assume the input values are distinct integers. % java LargestOfFive 17 23 5 1 6 23 % java LargestOfFive 8 3 -8 4 1 8

Respuesta :

Answer:

import java.io.*;

public class Larger {

  public static void main(String[] args) throws IOException{

       BufferedReader br=new BufferedReader(new InputStreamReader(System.in));// reading input from buffered reader

        int a,max=-99999,i;

        for(i=1;i<=5;i++)

        {

            a=Integer.parseInt(br.readLine());//converting string input string to int

            if(a >max)

               max=a;

         

        }

       System.out.println("Maximum value : "+max);

  }

Explanation:

ACCESS MORE
EDU ACCESS
Universidad de Mexico