Hey guys! I'm trying to make this flowchart but I not quite sure how to do it.
I'm supposed to make a flowchart that will ask the user a specific month and year, and the output would be how many days that that inputted month and year has.
Kinda confused about the number of days and leap year.
Thanks for your help guys!

Recommended Answers

All 2 Replies

With the number of days, consult your pc calendar.

To determine if year is a leap year.


1.if divisible by 400, leap year.
2. else, if div by 100, not leap year
3. else, if div by 4, leap year
4. else, not leap year.

Condense it to...

if (((year%4)==0 && (year%100)!=0) || (year%400)==0) {
  // leap year
}
else {
  // not leap year
}

*** Note *** This works only with modern year (AD). If you are talking about BC, it is not correct.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.