函式

user_3763047219 avatar
user_3763047219
c_cpp
11/03/2022 8:11 AM
536 B
13
Indexable
#include <stdio.h>
#define _CRT_SECURE_NO_WARNING
#include <ctype.h>
#include <assert.h>
#include <stdbool.h>

bool leap_year(int y) {
	bool is_leap = (y % 400 == 0) || (y % 4 == 0 && y % 100 != 0);
	return is_leap;
}

void main()
{
	int year;
	scanf_s("%d", &year);
	assert(year > 0);

	bool result = leap_year(year);

	if (result)
		printf("Yes\n");
	else
		printf("No\n");
}
Editor is loading...