fork download
  1. #include <stdio.h>
  2.  
  3. int leap(int year)
  4. {
  5. if(year % 400 == 0)
  6. {
  7. return 1;
  8. }
  9. else if(year % 100 == 0)
  10. {
  11. return 0;
  12. }
  13. else if(year % 4 == 0)
  14. {
  15. return 1;
  16. }
  17. else
  18. {
  19. return 0;
  20. }
  21. }
  22.  
  23. int main()
  24. {
  25. int year;
  26.  
  27. scanf("%d", &year);
  28.  
  29. if(leap(year))
  30. {
  31. printf("うるう年です\n");
  32. }
  33. else
  34. {
  35. printf("うるう年ではありません\n");
  36. }
  37.  
  38. return 0;
  39. }
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
うるう年ではありません