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
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
English,
5 months ago
Computer Science,
5 months ago
English,
10 months ago
English,
1 year ago
English,
1 year ago