<p>i don\'t know how to write a program im still a beginner here is the problem
ID: 3631565 • Letter: #
Question
<p>i don't know how to write a program im still a beginner here is the problem statement. can you help me out? thanks! :)</p><p> </p>
<p>All years that are evenly divisible by 400 or are evenly divisible by four and not evenly divisible by 100 are leap years. for example, since 1600 is evenly divisible by 400, the year 1600 was a leap year. similarly, since 1988 is evenly divisible by four but not by 100, the year 1988 was also a leap year. using this information, write a C++ program that accepts the year as user input, determine if the year is a leap year, and displays an appropriate message that tells the user if the entered year is or is not a leap year.</p>
<p> </p>
<p>thanks in advance and im in my class today hahaha</p>
Explanation / Answer
C program --------------------------------------------------------------------------- #include #include void main() { int y; printf("enter the year"); scanf("%d",&y); if(y%100==0) { if(y%400==0) { printf("%d is leap year"); } else { printf(" %d is not a leap year"); } } else { if(y%4==0) { printf("%d is a leap year"); } else { printf("%d is not a leap year"); } } getch(); } ------------------------------------------------------------------------------------------------------ C++ program ----------------------- #include // allows program to perform input and output using namespace std; // program uses names from the std namespace int leapyear (int yr) { if ((yr % 4 == 0) && !(yr % 100 == 0)) coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.