+ 2

Program to find whether the given year is leap year or not

https://code.sololearn.com/ctd1NiW8aNjN/?ref=app

17th Jul 2022, 12:03 PM
Ahmed Kazia
Ahmed Kazia - avatar
4 Answers
+ 2
You have no proper braces.. ( ) for if block. And it should be != , not just !. edit: public class leapyearexample { public static void main(String[] args) { int year=2020; if( ((year % 4==0)&&(year % 100 != 0))||(year % 400==0) ){ System.out.println("leap year"); } else{ System.out.println("common year"); } } }
17th Jul 2022, 12:21 PM
Jayakrishna 🇮🇳
+ 2
I already added corrected code. edited and adding here. You have missing one more pair of brace. if👉( condition ) 👈 edit: if( ((year % 4==0)&&(year % 100 != 0))||(year % 400==0) ){
17th Jul 2022, 12:25 PM
Jayakrishna 🇮🇳
+ 1
Bro there are 3 more error
17th Jul 2022, 12:23 PM
Ahmed Kazia
Ahmed Kazia - avatar
+ 1
Ahmed Kazia Get used to always provide full info. Instead of "there are x errors", always tell which ones.
18th Jul 2022, 1:55 AM
Emerson Prado
Emerson Prado - avatar