啊哈磊_编程从这里起步
标题:
【第三章第6节】动手试一试 题解
[打印本页]
作者:
rosynirvana
时间:
2014-4-21 18:21
标题:
【第三章第6节】动手试一试 题解
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c,d;
scanf("%d %d %d",&a,&b,&c);
if(a<b)
d=a;
else
d=b;
if(d<c)
printf("%d",d);
else
printf("%d",c);
system("pause");
return 0;
}
复制代码
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c,d,e;
scanf("%d %d %d %d",&a,&b,&c,&d);
if(a>b)
e=a;
else
e=b;
if(e<c)
e = c;
if(e<d)
e = d;
printf("%d",e);
system("pause");
return 0;
}
复制代码
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a;
scanf("%d",&a);
if((a%4==0 && a%100!=0) || (a%400==0))
printf("yes");
else
printf("no");
system("pause");
return 0;
}
复制代码
作者:
cad20020601
时间:
2014-5-25 09:47
作者:
wbb325
时间:
2014-9-27 15:01
第2题,比较出4个整数的最大值,这么写行不行?
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c,d,temp1,temp2;
scanf("%d %d %d %d",&a,&b,&c,&d);
if(a<b) temp1=b;
else temp1=a;
if(c<d) temp2=d;
else temp2=c;
if(temp1<temp2) printf("%d",temp2);
else printf("%d",temp1);
system("pause");
return 0;
}
反正编译是没问题的!
作者:
rosynirvana
时间:
2014-9-27 15:22
wbb325 发表于 2014-9-27 15:01
第2题,比较出4个整数的最大值,这么写行不行?
#include
#include
可以的
作者:
失忆蝴_JL0rl
时间:
2017-6-3 00:15
第一题后面这样写是不是也可以
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c,d;
scanf("%d %d %d",&a,&b,&c);
if(a<b)
d=a;
else
d=b;
if(c<d)
d=c;
printf("%d",d);
system("pause");
return 0;
}
欢迎光临 啊哈磊_编程从这里起步 (https://bbs.codeaha.com/)
Powered by Discuz! X3.2