| 1. |
Complete the code segment to help Ram , find the highest mark and average mark secured by him in "s" number of subjects. |
|
Answer» 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 { System.out.println(“Enter the number”); arr[i]=Integer.parseInt(in.readLine()); } int highest, AVG=0; for (int i=0;i { avg=avg+ar[i]; if(highest { highest=arr[i]; } } avg=avg/k; System.out.println(“Highest marks = ”+ highest); System.out.println(“Average marks = ”+ avg); } }
|
|