Computer Science, asked by krutig2770, 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 mayursanjaydeshmukh
8

Answer:

#include <iostream>

using namespace std;

int main()

{

int year;

cin >> year;

if (year % 4 == 0)

{

if (year % 100 == 0)

{

if (year % 400 == 0)

{

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

}

else

{

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

}

}

else

{

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

}

}

else{

cout <<"Vicky can't celebrate.";}

return 0;

}

Explanation:

Similar questions