write a program to accept name and total marks of N Number of students in two single subscript array name[] and totalmarks[].
Output
Enter name of students:3
Enter name of student: Affan
Enter the marks: 480
Enter name of students:Shubham
Enter the marks: 490
Enter name of students: prathamesh
Enter the marks: 500
The average of the total marks of 3 numbers of students: ==>490.0
Deviation of affans marks with average: ==>10.0
Deviation of shubham marks with average: ==> 0.0
Deviation of prathamesh marks with average: ==> 10.0
Answers
Explanation:
import java.io.*; import java. util. Scanner; class NameMarks { public static void main(String argsO) throws IOException { Scanner sc = new Scanner(System.in); System.out.print(“Enter number of students:”); int N = sc.nextlnt( ); String named = new String[N]; int totalmarksG = new int[N]; double deviation[ ] = new double[N]; double sum = 0; for (int i = 0; i < N; i+ +) { System.out.print(“Enter Name of the Student:”); name[i] = sc.next( ); System.out.print(“Enter Marks:”); totalmarks[i] = sc.nextlntO; sum = sum + totalmarks [i]; } double average = sum / N; System.out.println(“The average of the total marks of ” +N+” number of students:” +average); for (int i = 0; i < N; i+ +) { deviadon[i] = total marks (i] – average; System.out.println(“Deviation of” + name[i] + “s marks with the average:” +deviation[i]); } } }Read more on Sarthaks.com - https://www.sarthaks.com/837432/write-program-accept-name-total-marks-number-students-single-subscript-array-totalmarks?show=837439#a837439