KnowledgeBoat Logo

Computer Applications

Write a program to input marks in English, Maths and Science of 40 students who have passed ICSE Examination 2014. Now, perform the following tasks:

(a) Number of students, who have secured 95% or more in all the subjects.

(b) Number of students, who have secured 90% or more in English, Maths and Science.

Java

Java Iterative Stmts

80 Likes

Answer

import java.util.Scanner;

public class KboatExamResult
{
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        int ta = 0, te = 0, tm = 0, ts = 0;
        for (int i = 1; i <= 40; i++) {
            System.out.println("Enter marks of student " + i);
            System.out.print("English: ");
            int eng = in.nextInt();
            System.out.print("Maths: ");
            int maths = in.nextInt();
            System.out.print("Science: ");
            int sci = in.nextInt();
            
            if (eng >= 95 && maths >= 95 && sci >= 95)
                ta++;
            
            if (eng >= 90)
                te++;
                
            if (maths >= 90)
                tm++;
                
            if (sci >= 90)
                ts++;
        }
        System.out.println("No. of students >= 95% in all subjects: " + ta);
        System.out.println("No. of students >= 90% in English: " + te);
        System.out.println("No. of students >= 90% in Maths: " + tm);
        System.out.println("No. of students >= 90% in Science: " + ts);
    }
}

Variable Description Table

Program Explanation

Output

BlueJ output of Write a program to input marks in English, Maths and Science of 40 students who have passed ICSE Examination 2014. Now, perform the following tasks: (a) Number of students, who have secured 95% or more in all the subjects. (b) Number of students, who have secured 90% or more in English, Maths and Science.BlueJ output of Write a program to input marks in English, Maths and Science of 40 students who have passed ICSE Examination 2014. Now, perform the following tasks: (a) Number of students, who have secured 95% or more in all the subjects. (b) Number of students, who have secured 90% or more in English, Maths and Science.

Answered By

27 Likes


Related Questions