C program to check print number of days in month and month name using conditional operator. | सशर्त ऑपरेटर का उपयोग करके महीने और महीने के नाम की प्रिंट संख्या की जांच करने के लिए सी प्रोग्राम।












C program to check print number of days in month and month name using conditional operator.




C program to check print number of days in month and month name using conditional operator



#include <stdio.h> #include int main() { int month; printf("\n Enter any month number (1-12): "); scanf("%d", &month); (month == 1)? printf("\n January 31 days"): (month == 2)? printf("\n February 28 or 29 days"): (month == 3)? printf("\n March 31 days"): (month == 4)? printf("\n April 30 days"): (month == 5)? printf("\n May 31 days"): (month == 6)? printf("\n June 30 days"): (month == 7)? printf("\n July 31 days"): (month == 8)? printf("\n August 31 days"): (month == 9)? printf("\n September 30 days"): (month == 10)? printf("\n October31 days"): (month == 11)? printf("\n November30 days"): (month == 12)? printf("\n December 31 days"): printf("Invalid input! Please enter month number between (1-12)."); return 0; }


Output:
Enter any month number (1-12): 3 March 31 days Enter any month number (1-12): 8 August 31 days Enter any month number (1-12): 11 November 30 days