我的程序为每个输出显示“这是一个闰年”。请让我知道我在哪里犯了错误??
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
clrscr();
printf("\n Enter the year : ");
scanf("%d",a);
if (a%400 == 0)
printf("\n It is a leap year");
else
if (a%100 == 0)
printf("\n It is not a leap year");
else
if (a%4 == 0)
printf("\n It is a leap year");
else
printf("\n It is not a leap year");
getch();
最佳答案
scanf()
函数需要您传递变量的地址:
scanf("%d",&a);
关于c - 以下是我的闰年计划。它为每个输出显示闰年,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11029305/