KnowledgeBoat Logo

Computer Applications

Write a program to accept marks of a student obtained in 5 different subjects (English, Phy., Chem., Biology, Maths.) and find the average. If the average is 80% or more then he/she is eligible to get "Computer Science" otherwise "Biology".

Java

Input in Java

70 Likes

Answer

import java.io.*;

public class KboatMarks
{
    public static void main(String args[]) throws IOException {
        InputStreamReader read = new InputStreamReader(System.in);
        BufferedReader in = new BufferedReader(read);
        
        System.out.print("Enter marks in English: ");
        int eng = Integer.parseInt(in.readLine());
        
        System.out.print("Enter marks in Physics: ");
        int phy = Integer.parseInt(in.readLine());
        
        System.out.print("Enter marks in Chemistry: ");
        int chem = Integer.parseInt(in.readLine());
        
        System.out.print("Enter marks in Biology: ");
        int bio = Integer.parseInt(in.readLine());
        
        System.out.print("Enter marks in Maths: ");
        int math = Integer.parseInt(in.readLine());
        
        double avg = (eng + phy + chem + bio + math) / 5.0;
        
        if (avg >= 80) {
            System.out.println("Eligible for Computer Science");
        }
        else {
            System.out.println("Eligible for Biology");
        }
    }
}

Output

BlueJ output of Write a program to accept marks of a student obtained in 5 different subjects (English, Phy., Chem., Biology, Maths.) and find the average. If the average is 80% or more then he/she is eligible to get "Computer Science" otherwise "Biology".BlueJ output of Write a program to accept marks of a student obtained in 5 different subjects (English, Phy., Chem., Biology, Maths.) and find the average. If the average is 80% or more then he/she is eligible to get "Computer Science" otherwise "Biology".

Answered By

22 Likes


Related Questions