Leap Year
Completed
Read a year and print leap or common.
Input
One integer.
Output
One word.
Example
Input
2024
Output
leap
Editor
C
Hints
&& is and, || is or.
Solution explanation
Century years are leap years only when divisible by 400.
Show solution
#include <stdio.h>
int main() {
int y;
scanf("%d", &y);
if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0) {
printf("leap\n");
} else {
printf("common\n");
}
return 0;
}