Java program for grades of a single student in a simple if else method without using array
Sanjivanie:
with or without scanner
Answers
Answered by
0
Hi user!
class qwerty
{
public static void main()
{
double sub1=89,sub2=90,sub3=87;
double percent=((sub1+sub2+sub3)/3)*100;
System.out.println(" Your percentage is "+percent);
if(percent>85)
System.out.println("Grade: A");
else
{
if(percent>75)
System.out.println("Grade : B");
else
{
if(percent>65)
System.out.println(" Grade : C");
else
{
if(percent>40)
System.out.println(" Grade : D");
else
System.out.println(" Grade : E");
}
}
}
}
}
class qwerty
{
public static void main()
{
double sub1=89,sub2=90,sub3=87;
double percent=((sub1+sub2+sub3)/3)*100;
System.out.println(" Your percentage is "+percent);
if(percent>85)
System.out.println("Grade: A");
else
{
if(percent>75)
System.out.println("Grade : B");
else
{
if(percent>65)
System.out.println(" Grade : C");
else
{
if(percent>40)
System.out.println(" Grade : D");
else
System.out.println(" Grade : E");
}
}
}
}
}
Similar questions