This program will compute the 3 grades and get the average. the program will show a message "Your Passed" if the average is 75 above. else the program will show a message " Your Failed" if the average is Below 75.
here is the program.
import java.io.*;
public class ComputeAverage
{
public static void main(String args[])
{
//declaration of variables
int math=90;
int PE=90;
int prog=95;
int ave=0;
//Compute the average
ave=(math + PE + prog)/3;
//display the average
System.out.print("Your average is:" + ave);
//checking the average if it is 75 above or below 75 using if statement
if(ave>=75)
{
System.out.print("Your Passed");
}
else
{
System.out.print("Your Failed");
}
}
}
No comments:
Post a Comment