c语言小程序问题,我不知道哪的错误,哪位高手给我指点一下
#include<stdio.h>intmain(){intyear,leap;printf("enteryear:");scanf("%d",&year);if(yea...
#include<stdio.h>
int main()
{
int year,leap;
printf("enter year:");
scanf("%d",&year);
if(year%4!=0)
leap=0;
else if(year%100!=0)
leap=1;
else if(year%400!=0)
leap=0;
else
leap=1;
else
leap=0;
if(leap)
printf("%d is",year);
else
printf("%d is not",year);
printf("a leap year.\n");
return 0;
} 展开
int main()
{
int year,leap;
printf("enter year:");
scanf("%d",&year);
if(year%4!=0)
leap=0;
else if(year%100!=0)
leap=1;
else if(year%400!=0)
leap=0;
else
leap=1;
else
leap=0;
if(leap)
printf("%d is",year);
else
printf("%d is not",year);
printf("a leap year.\n");
return 0;
} 展开
3个回答
2011-05-06
展开全部
给你做的是100以内数的加减法,有负数,你可自己改成乘除。
#include <stdio.h>
#define N 10
main(){
int ans,a,b,i,fensu=0;
char opr;
for(i=1;i<=N;i++){
a=rand()%99+1;
b=rand()%99+1;
opr=rand()%2;
if(opr)
opr='+';
else
opr='-';
printf("\n%d. %d%c%d=",i,a,opr,b);
scanf("%d",&ans);
if(opr=='+'){
if(ans==(a+b))
fensu++;
}
if(opr=='-'){
if(ans==(a-b))
fensu++;
}
}
printf("\n fenfu =%d",fensu);
getch();
}
另外,虚机团上产品团购,超级便宜
#include <stdio.h>
#define N 10
main(){
int ans,a,b,i,fensu=0;
char opr;
for(i=1;i<=N;i++){
a=rand()%99+1;
b=rand()%99+1;
opr=rand()%2;
if(opr)
opr='+';
else
opr='-';
printf("\n%d. %d%c%d=",i,a,opr,b);
scanf("%d",&ans);
if(opr=='+'){
if(ans==(a+b))
fensu++;
}
if(opr=='-'){
if(ans==(a-b))
fensu++;
}
}
printf("\n fenfu =%d",fensu);
getch();
}
另外,虚机团上产品团购,超级便宜
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#include<stdio.h>
int main()
{
int year,leap;
printf("enter year:");
scanf("%d",&year);
if(year%4 != 0)
{
leap = 0;
}
else if(year%100 != 0)
{
leap=1;
}
else if(year%400 != 0)
{
leap=0;
}
else
{
leap=0;
}
if(leap)
printf("%d is",year);
else
{
printf("%d is not a leap year.\n",year);
}
return 0;
}
int main()
{
int year,leap;
printf("enter year:");
scanf("%d",&year);
if(year%4 != 0)
{
leap = 0;
}
else if(year%100 != 0)
{
leap=1;
}
else if(year%400 != 0)
{
leap=0;
}
else
{
leap=0;
}
if(leap)
printf("%d is",year);
else
{
printf("%d is not a leap year.\n",year);
}
return 0;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询