WAP to evaluate the result of a student by accepting marks in three
subjects. If any subject mark is less than 35 then the student is failing.
For average greater than equal to 60, the student is first - class else it is
second class. If the student does not fail then display the total mark
and average mark.
Only genuine answers.Useless answers will be reported.
Answers
import java.io.*;
class marks
{
public static void main(String args[])throws IOException
{
InputStreamReader read=new InputStreamReader(System.in);
BufferedReader in=new BufferedReader(read);
int a,b,c,av=0,tm=0;
System.out.println("Enter the marks of 1st subject");
a=Integer.parseInt(in.readLine());
System.out.println("Enter the marks of 2nd subject");
b=Integer.parseInt(in.readLine());
System.out.println("Enter the marks of 3rd subject");
c=Integer.parseInt(in.readLine());
av=(a+b+c)/3;
tm=a+b+c;
if(av>=35)
{
System.out.println("Total marks="+tm);
System.out.println("Average="+av);
if(av>=60)
System.out.println("First");
else
System.out.println("Second");
}
else
{
if(a<35||b<35||c<35)
System.out.println("Failed");
}
}
}
Answer:
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int a,b,c,total,average;
System.out.println("Enter marks in 1st subject");
a=sc.nextInt();
System.out.println("Enter marks in 2nd subject");
b=sc.nextInt();
System.out.println("Enter marks in 3rd subject");
c=sc.nextInt();
total=a+b+c;
average=(a+b+c)/3;
if((a<35)&&(b<35)&&(c<35))
{
System.out.println("Student is fail");
}
if(average>=60)
{
System.out.println("Student is in First class");
System.out.println("Total marks in 3rd subject= "+total);
System.out.println("Average marks = "+average);
}
if((average<60)&&(average>35))
{
System.out.println("Student is in Second class");
System.out.println("Total marks in 3rd subject= "+total);
System.out.println("Average marks = "+average);
}
}
}
Explanation:
it is a java program