C语言程序设计(第3版_乌云高娃)同步实训指导参考答案2.1 (6)[1页]

2022-06-07 18:50:14   文档大全网     [ 字体: ] [ 阅读: ]

#文档大全网# 导语】以下是®文档大全网的小编为您整理的《C语言程序设计(第3版_乌云高娃)同步实训指导参考答案2.1 (6)[1页]》,欢迎阅读!
高娃,乌云,程序设计,同步,答案
深圳职业技术学院



C语言程序设计

同步实训指导参考答案



序号:3.2

任务1:任务1 从键盘输入2个整数,输出较大的一个数。要求用if语句完成。 #include "stdio.h" void main() {

int xy; int mxx;

printf("please input 2 integer:"); scanf("%d,%d",&x,&y); max=x;

if(y

printf("\n the max is %d",max); }

任务2:从键盘输入2个整数,输出较大的一个数。要求用if-else语句完成 #include "stdio.h" void main() {

int xy; int mxx;

printf("please input 2 integer:"); scanf("%d,%d",&x,&y); if(xy)

max=x; else

max=y;

printf("\n the max is %d",max); }

任务3 从键盘输入2个整数,输出较大的一个数。要求用条件语句完成。 #include "stdio.h" void main() {

int xy; int mxx;

printf("please input 2 integer:"); scanf("%d,%d",&x,&y); max=x>y?x:y;

printf("\n the max is %d",max); }

1


本文来源:https://www.wddqxz.cn/ccdab655e618964bcf84b9d528ea81c758f52e00.html

相关推荐