Our professor asked us to create a code that prints what grade you should be getting for a particular score, in a nested if code in Java
import java.util.Scanner;
public class nestedif {
public static void main(String []args){
Scanner sc = new Scanner(System.in);
int tscore = sc.nextInt();
if (tscore >=60){
System.out.println("D");
if (tscore >=70){
System.out.println("C");
if (tscore >=80){
System.out.println("B");
if (tscore >=90){
System.out.println("A");
}
}
}
}
else {
System.out.println("tae");
}
}
}
it prints the grade but it also includes the first if's statement ex input: 90 output: A B C D