Contoh Program If ElseIf Else (Logic Error)

Run Settings
LanguageJava
Language Version
Run Command
class Main { public static void main(String[] args) { int belanja = 800_000; int diskon = 0; if(belanja > 100_000) { diskon = 5_000; System.out.println("Total belanja: "+ (belanja - diskon )); } else if (belanja > 500_000) { diskon = 25_000; System.out.println("Total belanja: "+ (belanja - diskon)); } else { System.out.println("Total belanja: "+ (belanja - diskon)); } } }
Editor Settings
Theme
Key bindings
Full width
Lines