Computer Science, asked by Devanshsrv27, 1 year ago

Pleaae solve this is urgent , solve with do while loop and scanner method

Attachments:

Answers

Answered by NeelarghyaKundu
1

Here is your answer mate

import java.util.*;

class cricket

{

    public void main()

   {

       Scanner sc=new Scanner(System.in);

       System.out.println("Enter the runs scored by the 11 players");

       int a[]=new int[11];

       for(int i=0;i<11;i++)

           a[i]=sc.nextInt();

       int total=0,j=0,max=a[0];

       do {

           total=total+a[j];

           if(max<a[j])

               max=a[j];

           j++;

       }

       while(j<11);

       System.out.println("Total run="+total);

       System.out.println("Average"+(total/11.0));

       System.out.println("highest="+max);

   }

}

Hope this helps :)



Devanshsrv27: Thank you so much
Similar questions