A leap year occurs when the year number (e.g. 1984 ) is divisible by 4. But there is a special case for years ending in 00: these must be divisible by 400 to be considered a leap year. Thus, 1900 was not a leap year, but 2000 was. Write an if-statement that determines if the integer variable year represents a leap year. (Hint: use the % operator for taking remainders.)

What will be an ideal response?


if (year % 100 == 0 && year % 400 == 0 ||
year % 100 != 0 && year % 4 == 0)
System.out.println(“It’s a leap year.”);

Computer Science & Information Technology

You might also like to view...

What router command shows how many subnets are configured?

a. show run b. show ip int brief c. show list d. show ip route

Computer Science & Information Technology

When you hold down the CTRL key while rolling the mouse wheel, text on the screen may become larger or smaller based on the direction you roll the wheel. _______________

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The Tolerance tools on the Tools panel includes the Magic Wand and ____ tools.

A. Quick Selection B. Marquee C. Quick Mask D. MegaPixel

Computer Science & Information Technology

In ____________________ transmission, data is sent when it is ready to be sent, without being synchronized.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology