Hi guys, i am not able to access the elseif part, shall i know what is the mistake i have done ??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 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"); } } }

1st May 2020, 5:40 PM
dineshkumar
dineshkumar - avatar
1 Answer
+ 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.
1st May 2020, 5:51 PM
Kevin ★