[go: up one dir, main page]

0% found this document useful (0 votes)
67 views1 page

Computer Lab Work Igsce

The Java program collects marks for five subjects from the user and calculates the total and average marks. It provides feedback based on the average, indicating whether the performance is excellent or if improvement is needed. The program uses conditional statements to display different messages based on the average score.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views1 page

Computer Lab Work Igsce

The Java program collects marks for five subjects from the user and calculates the total and average marks. It provides feedback based on the average, indicating whether the performance is excellent or if improvement is needed. The program uses conditional statements to display different messages based on the average score.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import java.util.

Scanner;
public class Main{
public static void main (String[]args){
Scanner x = new Scanner (System.in);
double t[] = new double[5];
t[0] = x.nextDouble();
System.out.print("enter the marks for physics");
t[1] = x.nextDouble();
System.out.print("enter the marks for chemistry");
t[2] = x.nextDouble();
System.out.print("enter the marks for maths");
t[3] = x.nextDouble();
System.out.print("enter the marks for biology");
t[4] = x.nextDouble();
System.out.print("enter the marks for computer science");
double Sum = t[0]+t[1]+t[2]+t[3]+t[4];
System.out.print ("total marks= "+ Sum);
double Average = Sum/5;
System.out.print ("Average marks= "+ Average);
if(Average>=20){
System.out.print("excellent!");
}
if(Average>=24) {
System.out.print("and carry on");
}
if(Average<24){
System.out.print("better luck next time!");
}
else{
System.out.print("need to work more!"); }
}
}
}

You might also like