Write a Java program to input the runs scored by 11 batsman in a cricket match and display the highest score.

import java.util.*;
public class Main
{
    public static void main(String [] args)
    {
        int [] arr = new int[11];
        int max=0;
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter The Runs Scored By Batsman");
        for(int i=0;i<arr.length;i++)
        {
            arr[i] = sc.nextInt();
        }

        for(int i=0;i<arr.length;i++)
        {
            if(arr[i]>max)
                max = arr[i];
        }
        System.out.println("Maximum Run Scored" +" " +max);

    }
}

Post a Comment

0 Comments