Write a Program To Input the Marks and Display the Grades Accordingly using if-else in Java
import java.util.*;
class Marks
{
public static void main(String args[])
{
int m;
Scanner sc=new Scanner(System.in);
System.out.println("Enter the Marks:");
m=sc.nextInt();
if(m>=80)
{
System.out.println("Distinction");
}
else if(m>=60 && m<80)
{
System.out.println("First Division");
}
else if(m>=45 && m<60)
{
System.out.println("Second Division");
}
else if(m>=40 && m<45)
{
System.out.println("Pass");
}
else
{
System.out.println("Promotion Not Granted");
}
}
}
OUTPUT:
Enter the Marks:
90
Distinction
YouTube Videos for Explanation
https://www.youtube.com/watch?v=aqNaKEncMVE
class Marks
{
public static void main(String args[])
{
int m;
Scanner sc=new Scanner(System.in);
System.out.println("Enter the Marks:");
m=sc.nextInt();
if(m>=80)
{
System.out.println("Distinction");
}
else if(m>=60 && m<80)
{
System.out.println("First Division");
}
else if(m>=45 && m<60)
{
System.out.println("Second Division");
}
else if(m>=40 && m<45)
{
System.out.println("Pass");
}
else
{
System.out.println("Promotion Not Granted");
}
}
}
OUTPUT:
Enter the Marks:
90
Distinction
YouTube Videos for Explanation
https://www.youtube.com/watch?v=aqNaKEncMVE
Comments
Post a Comment