#include<conio.h>
#include <stdio.h>
main()
{
int year,check1,check2,check3 ; <<<ตรงนี้ขึ้นแดงค่ะ
printf("\t\tProgram check 'Leap year'.\n");
printf("\t\tInput 'yyyy' Only.\n");
printf("\t\tInput:");
scanf(" %d ",&year);
check1=year%4;
check2=year%400;
check3=year0;
if (check1==0){
if(check3!=0){
printf(" %d is a leap year.\n",year);
}else if(check3==0&&check2==0){
printf(" %d is a leap year.\n",year);
}else{
printf(" %d is not a leap year.\n",year);
}
}else{
printf(" %d is not a leap year.\n",year);
}
}else{
printf("\t\tData fail.!!!\n");
}
}
return 0;
}
ช่วยดู C++ โปรแกรมอธิกวาร มันผิดตรง Int หาแค่ปีนะค่ะ
#include <stdio.h>
main()
{
int year,check1,check2,check3 ; <<<ตรงนี้ขึ้นแดงค่ะ
printf("\t\tProgram check 'Leap year'.\n");
printf("\t\tInput 'yyyy' Only.\n");
printf("\t\tInput:");
scanf(" %d ",&year);
check1=year%4;
check2=year%400;
check3=year0;
if (check1==0){
if(check3!=0){
printf(" %d is a leap year.\n",year);
}else if(check3==0&&check2==0){
printf(" %d is a leap year.\n",year);
}else{
printf(" %d is not a leap year.\n",year);
}
}else{
printf(" %d is not a leap year.\n",year);
}
}else{
printf("\t\tData fail.!!!\n");
}
}
return 0;
}