So I have a question. I think I pretty much wrote the program right but, I can't seem to get it to work. I keep getting an error message because of the "else if(75 > marks > 50){" part of the program. How do I get it to work?
Here is my program. public class my class { public static void main(String []args) { int marks; if(marks>75){ System.out.println("Excellent"); } else if(75 > marks > 50){ System.out.println("Satisfactory"); } else if(50 > marks > 40){ System.out.println("Needs Improvement"); } else if(marks<40){ System.out.println("Failing"); } } }
else if( ( 75 > marks ) && ( marks > 50 ) ) {
Thank you. I figured it out like 5 minutes after posting the question. I felt pretty stupid after seeing how simple it was.
Join our real-time social learning platform and learn together with your friends!