The marks obtained by a student in 5 different subjects are input through the keyboard. The student gets a division as per the following rules: Write a program to calculate the division obtained by the student
This is a Java program that calculates the total marks and percentage of a student based on their input for five subjects, and then determines their division based on the percentage.
import java.util.Scanner; class Student_Division { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter The Five Subject Marks :"); int m1 = input.nextInt(); int m2 = input.nextInt(); int m3 = input.nextInt(); int m4 = input.nextInt(); int m5 = input.nextInt(); int tot = m1+m2+m3+m4+m5; float per = tot/5; System.out.println("Total :"+tot); System.out.println("Percentage :"+per); if(per>=60) { System.out.println("First Division."); } else if(per>=50 && per<=59) { System.out.println("Second Division."); } else if(per>=40 && per<=49) { System.out.println("Third Division."); } else { System.out.println("Fail."); } } }
Enter The Five Subject Marks : 56 43 75 68 70 Total :312 Percentage :62.0 First Division.
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions