WAP a Java Program to read roll no, name, and marks of three subjects and calculate the total, percentage, and division

import java.util.*; class CT4 { public static void main(String[] args) { String n; int rol; int hm, mm, sm; int t; double p; Scanner sc = new Scanner(System.in); System.out.print("Enter your name : "); n = sc.nextLine(); System.out.print("Enter your Roll Number : "); rol = sc.nextInt(); System.out.print("Enter your Hindi Marks : "); hm = sc.nextInt(); System.out.print("Enter your Maths Marks : "); mm = sc.nextInt(); System.out.print("Enter your Science Marks : "); sm = sc.nextInt(); t = hm + mm + sm; p = t / 3; System.out.println(n + " your Total Marks is : " + t); System.out.println(n + " your Percentage is : " + p + "%"); if (p > 60) { System.out.print(n + " you got First division."); } else if (p < 60 && p >= 45) { System.out.print(n + " you got Second division."); } else { System.out.print(n + " you got Third division. Work Hard!!"); } } } Copy Code
Expected Output:

Enter your name: Hardik Srivastava
Enter your Roll Number: 123
Enter your Hindi Marks: 75
Enter your Maths Marks: 85
Enter your Science Marks: 65
Hardik Srivastava your Total Marks is: 225
Hardik Srivastava your Percentage is: 75.0%
Hardik Srivastava you got First division.