Computer Science, asked by RosyX, 1 year ago

Write a Java program to display whether the given year is a leap year or not , using a turnery (conditional) operator.
Please give me the Program.

Answers

Answered by GB2010
3
Hiii....
Programm....

public class Leap year {

public static void main ( string [ ] args ) {

int year = 1900 ;
boolean leap = false ;

if ( year % 4 = = 0 )
{

if ( year % 100 = = 0 )
{

// year is divisible by 400 , hence year ia leap year

if ( year % 400 = = 0 )
leap = true ;

else
leap = false ;

}
else
leap = true ;

}
else
leap = false ;
if ( leap)
system . out .println ( year + " is a leap year " )

else
system.out.println ( year + " is not a leap year " )

}
}

I hope it helps........☺☺☺☺☺☺

GB2010: My programm is absolutely true...
siddhartharao77: Yes..It is absolutely correct Except Small spelling mistakes.
RosyX: thanx i got it
GB2010: mark me as brainlist dear...
GB2010: thanks...
RosyX: welcm
Similar questions