Computer Science, asked by nehanaik972, 11 months ago

Complete the code segment to help Ram , find the highest mark and average mark secured by him in "s" number of subjects.

Answers

Answered by sailorking
10

Answer:

import java.io.*;

class check

{

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

                             {

  System.out.println(“Enter the number of subjects”);

                                           int n=Integer.parseInt(in.readLine());

                                 int arr[]=new int [n];

     System.out.println(“Enter the number of subects among which you want the average and highest marks”);

                                           int k=Integer.parseInt(in.readLine());

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

{

   System.out.println(“Enter the number”);

                                            arr[i]=Integer.parseInt(in.readLine());

}

int highest, avg=0;

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

{

avg=avg+ar[i];

if(highest<arr[i])

{

highest=arr[i];

}

}

avg=avg/k;

System.out.println(“Highest marks = ”+ highest);

System.out.println(“Average marks = ”+ avg);

}

}

Similar questions