- 1
Hi guys, i am not able to access the elseif part, shall i know what is the mistake i have done ???
public class Program { public static void main(String[] args) { int sales=1; if(sales<7) {System.out.println("Profit"); } else if(sales == 7){ System.out.println("Broke Even"); } else{ System.out.println("Loss"); } } }
3 Réponses
+ 2
The code is working fine. If you change the sales variable to 7 you'll reach the else if part. I can't remember if this is a Code Coach Challenge. Don't forget to take input if so.