fork(1) download
  1. #include <stdio.h>
  2.  
  3. int Leap(int year) {
  4. if (year % 400 == 0) return 1;
  5. else if (year % 100 == 0) return 0;
  6. else if (year % 4 == 0) return 1;
  7. else return 0;
  8. }
  9.  
  10. int main() {
  11. int year;
  12.  
  13. printf("西暦年を入力してください: ");
  14. scanf("%d", &year);
  15.  
  16. if (Leap(year))
  17. printf("%d年は閏年です。\n", year);
  18. else
  19. printf("%d年は平年です。\n", year);
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0s 5324KB
stdin
400
stdout
西暦年を入力してください: 400年は閏年です。