Determine o ano bissexto (função)

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
void leap_year(int x)
{
    
    
	if (((x % 4 == 0) && (x % 100 != 0)) || (x % 400 == 0))
	{
    
    
		printf("%d 是闰年\n", x);
	}
	else
		printf("%d 不是闰年\n", x);
}
int main()
{
    
    
	int year = 0;
	printf("请输入年份: ");
	scanf("%d", &year);
	leap_year(year);
	return 0;
}

Exibição do resultado:
Insira a descrição da imagem aqui

Acho que você gosta

Origin blog.csdn.net/qq_45658339/article/details/108170071
Recomendado
Clasificación