IT STUDENT
Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

Nhập vào tháng và năm, in ra số ngày của có trong tháng

Go down  Message [Page 1 of 1]

Admin


Admin

code:
include<stdio.h>
#include<conio.h>
int main () {
int n,i;
printf("sothang: ",n);
scanf("%d",&n);
printf("nam: ",i);
scanf("%d",&i);
if(n<1||n>13)
printf("nhap lai");
else
{
switch(n)
{
case 3 :
case 1:
case 5:
case 7:
case 8:
case 10:
case 12:
printf("\n thang co 31 ngay");
break;
case 2:
if(i%4==0&&i%100!=0||i%400==0)
printf("\n co 29 ngay");
else{

printf("\n co 28 ngay");
}
break;
case 4 :
case 6:
case 9:
case 11:
printf("\nlathang co 30 ngay");
break;
default:
printf("khong phai thang trong nam");
break;
}
}getch();
}

https://itstudent-pnv.board-directory.net

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum