-
Notifications
You must be signed in to change notification settings - Fork 0
/
month.c
63 lines (61 loc) · 1.58 KB
/
month.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* @file month.c
* 22.Write a program to input month number and print that month name and number of days in that month.
* @author Md. Alamin (alamin5g@yahoo.com)
* I would love be a software engineer at Google. That is why anybody can uses this code without any condition, if you face any difficulty, then try to email me.
* @version 0.1
* @date 2022-03-13
*
* @copyright Copyright (c) 2022
*
*/
#include <stdio.h>
void main(){
int monthNo;
printf("Enter a month no. to show that month name: ");
scanf("%d", &monthNo);
if (monthNo>=1 && monthNo<=12)
{
switch (monthNo)
{
case 1:
printf("Janauary\n31 Days");
break;
case 2:
printf("February\n28 Days");
break;
case 3:
printf("March\n31 Days");
break;
case 4:
printf("April\n30 Days");
break;
case 5:
printf("May\n31 Days");
break;
case 6:
printf("June\n30 Days");
break;
case 7:
printf("July\n31 Days");
break;
case 8:
printf("August\n31 Days");
break;
case 9:
printf("September\n30 Days");
break;
case 10:
printf("October\n31 Days");
break;
case 11:
printf("November\n30 Days");
break;
default:
printf("December\n31 Days");
break;
}
}else{
printf("%d is out of range of month NO.", monthNo);
}
}