c program to find number of days in a month using switch case
/**
* C program to print number of days in a month using switch case
*/
#include <stdio.h>
int main()
{
int month;
/* Input month number from user */
printf("Enter month number(1-12): ");
scanf("%d", &month);
switch(month)
{
case 1:
printf("31 days");
break;
case 2:
printf("28/29 days");
break;
case 3:
printf("31 days");
break;
case 4:
printf("30 days");
break;
case 5:
printf("31 days");
break;
case 6:
printf("30 days");
break;
case 7:
printf("31 days");
break;
case 8:
printf("31 days");
break;
case 9:
printf("30 days");
break;
case 10:
printf("31 days");
break;
case 11:
printf("30 days");
break;
case 12:
printf("31 days");
break;
default:
printf("Invalid input! Please enter month number between 1-12");
}
return 0;
}
Also in C:
- sleep function in c
- fread
- c flip variable
- typedef in c
- factorial of a given number in c
- method abstraction
- default password raspberry pi
- c right bit shift
- how can i remove a specific item from an array
- c \a
- c \b
- how to globally initlailize a struct
- c calloc
- strcat in c
- warning: function returns address of local variable [-Wreturn-local-addr]
- cmd command with c
- vbnet create and write on file
- main function in c
- typedef vs #define
- 233 pounds to inr
- diamond dataset in r
- ruby find object in array by attribute
- how to input a string into a char array cpp
- molotovn't ribbentropn't pact