1. Engineering
  2. Computer Science
  3. please helpmy code is showing 1 error i dont know...

Question: please helpmy code is showing 1 error i dont know...

Question details

Please help...my code is showing 1 error. I don't know how to fix.

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

bool isLeap(int year);

int main() {
  
int year;

while(year > 0){
printf("Enter a year:");
scanf("%4d", &year);
if (isLeap(year)){
printf("Year %4d is a leap year.", year);
}
else if (!isLeap(year)) {
printf("Year %4d is not a leap year.", year);
}
return 0;
}

bool isLeap(int year)
{
if((year/4 == 0) && (year/100 != 0)){
return true;
}
else if (year/400 == 0){
return true;
}
else {
return false;
}
}
}

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution