printf("ho_tari\n");
ordinaryLeap 본문
#include <stdio.h>
int main(void)
{
int year;
scanf("%d", &year);
//int isLeap = (year % 4 == 0 && year % 100 != 0 || year % 400 == 0);
//int isLeap = (year % 400 == 0 || year % 4 == 0 && year % 100 != 0);
//printf("%d is leap : %d\n", year, isLeap);
if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
{
printf("%d is a leap year\n", year);
}
else
{
printf("%d is an ordinary year\n", year);
}
return 0;
}
#include <stdio.h>
int main(void)
{
int year;
scanf("%d", &year);
//int isLeap = (year % 4 == 0 && year % 100 != 0 || year % 400 == 0);
//int isLeap = (year % 400 == 0 || year % 4 == 0 && year % 100 != 0);
//printf("%d is leap : %d\n", year, isLeap);
// if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
// {
// printf("%d is a leap year\n", year);
// }
// else
// {
// printf("%d is an ordinary year\n", year);
// }
printf("%d is %s year\n", year,
(year % 4 == 0 && year % 100 != 0 || year % 400 == 0) ? "a leap" : "an ordinary");
return 0;
}
<compile 결과>