current position:Home>Error in function solving leap year problem

Error in function solving leap year problem

2022-06-24 09:57:54CSDN Q & A

Use function calls to solve leap year problems , But all the years that appear are leap years , So crazy
The code is as follows :

#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int is_runnian(int j)
{
if ((j % 4 == 0 && j % 100 != 0) || (j % 400 == 0))
return 1;
else
return 0;
}
int main()
{
int year;
for (year = 1000; year <= 2000; year++)
{
if (1 == is_runnian(year));
{
printf("%d It's a leap year ", year);

    }}return 0;

}

img

You can't change the answer , I blew it up .

I hope you can solve this problem , It saved my dog's life .

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/175/202206171702416279.html

Random recommended