0

Can someone please tell me what is wrong with this code

import java.util.*; public class Program { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int marks = sc.nextInt(); int i; do{ if (marks >90) { System.out.println("this is good"); }else if (marks<90 && marks > 60){ System.out.println("this is good too"); } else (marks < 59 && marks >0) System.out.println("this is good as well , because marks doesnot matter"); System.out.println("if you want to continue press 1 else 0"); i=sc.nextInt(); }while(i==1); } }

12th Aug 2022, 8:44 AM
Yogesh Soni
Yogesh Soni - avatar
1 Answer
+ 2
You cannot add the condition directly with the else keyword, You need to add "if" because only if contains the condition, not else part... So in case of (marks <59 && marks >0) add if keyword befor this condition
12th Aug 2022, 9:45 AM
Pallavi Jha
Pallavi Jha - avatar