Leer una fecha, pedir un numero de dias que se suma a esa fecha, mostrar la fecha final
#include <stdio.h> #include <stdbool.h> struct Date { int year; int month; int day; }; int numberOfDays (struct Date d) { int days; bool isLeapYear (struct Date d); const int daysPerMonth[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; if (isLeapYear (d) == true && d.month == 2) days = 29; else days = daysPerMonth[d.month - 1]; return days; } bool isLeapYear (struct Date d) { bool leapYearFlag; if ((d.year % 4 == 0 && d.year % 100 != 0) || d.year % 400 == 0) leapYearFlag = true; else leapYearFlag = false; return leapYearFlag; } int main (void) {