c - 以下是我的闰年计划。它为每个输出显示闰年

标签 c lang leap-year

我的程序为每个输出显示“这是一个闰年”。请让我知道我在哪里犯了错误??

#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/

相关文章:

java - "AWT-EventQueue-0"java.lang.NullPointerException - 需要一些建议

python - 找出是否是闰年并相应地设置

statistics - 在比较年度销售额时计算闰年

c++ - 如何在C应用程序中使用C++ DLL?

c - 如何使用 execlp() 查找 pid?

codeigniter - 使用 Codeigniter 和 smarty 进行国际化

windows - 如何国际化 Delphi 应用程序

java - 日期计算器 : Tell what day of the week a certain date is

c - 渲染为一维纹理

c - 为什么我不能将我的 "for"索引直接传递给 pthread_create 调用?