

InterviewSolution
1. |
write a program to input the marks of 3 subjects and the subject name display the subject name and average mark of students |
Answer» java.util.*;PUBLIC class AVG{ public static void main (String args []) { Scanner sc=new Scanner (System.in); System.out.println("Please ENTER The Name Of The First Subject"); char Sub1 = sc.next().charAt(0); System.out.println("Please Enter The Marks"); DOUBLE a = sc.nextDouble(); System.out.println("Please Enter The Name Of The Second Subject"); char Sub2 = sc.next().charAt(0); System.out.println("Please Enter The Marks"); double b = sc.nextDouble(); System.out.println("Please Enter The Name Of The THIRD Subject"); char Sub3 = sc.next().charAt(0); System.out.println("Please Enter The Marks"); double c = sc.nextDouble(); double avg = (a+b+c)/3; System.out.println("Average Marks = "+avg);sc.close(); }} |
|