fork download
  1. #include<stdio.h>
  2. typedef struct {
  3. int year;
  4. int month;
  5. int day;
  6. }Date;
  7. Date input_date( Date ymd );
  8. int isLeap( Date days );
  9. int main(void)
  10. {
  11. Date date;
  12. date = input_date( date );
  13. if( isLeap( date ) ){
  14. printf("%d/%d/%d is a leap.\n", date.year, date.month, date.day );
  15. }
  16. return 0;
  17. }
  18. Date input_date( Date ymd )
  19. {
  20. printf("year : \n"); scanf("%d", &ymd.year );
  21. printf("month : \n"); scanf("%d", &ymd.month );
  22. printf("day : \n"); scanf("%d", &ymd.day );
  23. return ymd;
  24. }
  25. int isLeap( Date days )
  26. {
  27. return ( days.year%4 == 0 && days.year%100 != 0 || days.year%400 == 0 );
  28. }
  29.  
Success #stdin #stdout 0.01s 5284KB
stdin
2024
10
22
stdout
year  : 
month : 
day   : 
2024/10/22 is a leap.