English, asked by mohanteja5555, 10 months ago

Vicky's birthday is on February 29th. He can only celebrate his birthdays in leap year. Can you help Vicky to determine whether he can celebrate his birthday in the year mentioned by him. Input should be an integer. (Usage : nested if)

Answers

Answered by THUNDERBOLT007
3

There are going to be misunderstandings about such a birthday (some people don't even know Feb. 29 as a valid date). Usually it is celebrated on Feb. 28 or March 1 ( yes, I know March 1 is not in February) in nonleap years. If your birthday is Feb. 29, you get older just like people not born Feb. 29. If you are in receipt of a notice “if you were born after (today's month and day) in year ____, you are not old enough”; this was the case for people born Feb. 29, 1996, who in this case had to use March 1 as the date they reached 21 this year (2017).

Feb. 29 exists because a year is very close to being 365_1/4 days long (i.e. not an integer number of days). Civilization requires an integer number of days, so insertion of Feb. 29 helps keep the calendar in line with the seasons.

Answered by 17euec155
4

Answer:

#include<iostream>

int main()

{

 int a;

 std::cin>>a;

 if( a%4==0 )

 {

   std::cout<<"Vicky can celebrate his birthday.";

 }

 else

 {

   std::cout<<"Vicky can't celebrate.";

 }

}

Explanation:

He can celebrate his birthday only if its a leap year .

so we have used the condition """ if( a%4==0 ) """,to check whether its a leap year or not.

Similar questions