-
Language
SciLab
-
Description
It accepts the number of the month in a year and returns the number of days in that month.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
number_of_the_month = input ("Enter the value of number of the month: ");
number_of_days=0;
if number_of_the_month==2 then
number_of_days=28;
end,
if number_of_the_month==1 | number_of_the_month==3 | number_of_the_month==5 | number_of_the_month==7 | number_of_the_month==8 | number_of_the_month==10 | number_of_the_month==12 then
number_of_days=31;
end,
if number_of_the_month==4 | number_of_the_month==6 | number_of_the_month==9 | number_of_the_month==11 then
number_of_days=30;
end,
if number_of_the_month<1 | number_of_the_month>12 then
printf ("Wrong month number\n");
end,
printf ("Value of number of days: %d\n", number_of_days);
end
number_of_days=0;
if number_of_the_month==2 then
number_of_days=28;
end,
if number_of_the_month==1 | number_of_the_month==3 | number_of_the_month==5 | number_of_the_month==7 | number_of_the_month==8 | number_of_the_month==10 | number_of_the_month==12 then
number_of_days=31;
end,
if number_of_the_month==4 | number_of_the_month==6 | number_of_the_month==9 | number_of_the_month==11 then
number_of_days=30;
end,
if number_of_the_month<1 | number_of_the_month>12 then
printf ("Wrong month number\n");
end,
printf ("Value of number of days: %d\n", number_of_days);
end