// This tut contains conditional statements.
/*
#include <iostream>
int main() {
int number = 9;
switch(number) {
case 1 :
std::cout << "Bulbusaur\n";
break;
case 2 :
std::cout << "Ivysaur\n";
break;
case 3 :
std::cout << "Venusaur\n";
break;
case 4 :
std::cout << "Charmander\n";
break;
case 5 :
std::cout << "Charmeleon\n";
break;
case 6 :
std::cout << "Charizard\n";
break;
case 7 :
std::cout <<"Squirtle\n";
break;
case 8 :
std::cout <<"Wartortle\n";
break;
case 9 :
std::cout <<"Blastoise\n";
break;
default :
std::cout << "Unknown\n";
break;
}
}
*/
#include <iostream>
int main() {
int year;
std::cout<<"Enter the year :";
std::cin>>year;
if(year<1000 && year>9999){
std::cout<<"The year is not four digit number";
}
else if(year % 4 ==0 && year % 100!=0 || year % 400==0){
std::cout<<year;
std::cout<<" falls on a leap year.\n";
}
else{
std::cout << year;
std::cout << " is not a leap year.\n";
}
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.