ich weiss bei folgendem Problem nicht was ich falsch gemacht habe.
mein VorschlagProblem statement
Your function is given a year greater than 1000 AD and less than 10000 AD. Return the string "Leap year" if the given year is a leap year and "Not a leap year" otherwise.
A year is considered a leap year if it is perfectly divisible by 4. Years that are perfectly divisible by 100 (for example, 2000, 2100, 2200) are exceptions. Such a year is a leap year only if it is also perfectly divisible by 400.
Code: Alles auswählen
const char * isLeapYear(int year)
{
char ly[]= "Leap year";
char nly[]= "Not a leap year";
if((year%4==0 && year%100!=0 )|| (year%100==0 && year%400==0)){
return ly;
}else {
return nly;
}
/* Complete this function */
}