/* * Author : Amit Dutta * Date : 12 Dec 2025 * Repo : https://github.com/notamitgamer/bsc * License : MIT License (See the LICENSE file for details) */ /* Write a C program that takes an integer input representing a month (1 to 12) and a year. Use a switch statement to display the number of days in that month, considering leap years. */ #include int main() { int month, year, days; printf("Enter the month (1 to 12) and year: "); scanf("%d %d", &month, &year); switch (month) { case 1: // jan case 3: // mar case 5: // may case 7: // july case 8: // aug case 10: // oct case 12: // dec days = 31; break; case 4: // apr case 6: // jun case 9: // sep case 11: // nov days = 30; break; case 2: // feb if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) { days = 29; } else { days = 28; } break; default: printf("\nYou entered something wrong."); return 0; } printf("\nNumber of days: %d", days); return 0; }