If the marks obtained by a student in five different subjects are input through the keyboard, find out the aggregate marks and percentage marks obtained by the student. Assume that the maximum marks that can be obtained by a student in each subject is 100.
Overall, this program is a basic example of how Java can be used to perform simple mathematical operations and input/output operations.
import java.util.Scanner; class Student_Mark { public static void main(String arga[]) { int s1,s2,s3,s4,s5,total; float per; Scanner input = new Scanner(System.in); System.out.println("Enter the Five Subject Mark :"); s1 = input.nextInt(); s2 = input.nextInt(); s3 = input.nextInt(); s4 = input.nextInt(); s5 = input.nextInt(); total = s1+s2+s3+s4+s5; per = total/5; System.out.println("Total : "+total); System.out.println("Percentage : "+per); } }
Enter the Five Subject Mark : 89 56 97 88 92 Total : 422 Percentage : 84.0
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions