选两个数中的大数并输出。程序如下:
#include
main()
{double max,a,b;
sacanf("%lf,%lf",&a,&b);
if(a>=b)
;
else
;
printf("%f",max);
}
#include
main()
{double max,a,b;
sacanf("%lf,%lf",&a,&b);
if(a>=b)
;
else
;
printf("%f",max);
}
举一反三
- __________________(double,double);main(){doublex,y;scanf("%lf%lf",&x,&y);printf("%lf",max(x,y));}doublemax(doublea,doubleb){return(a>b?a:b);}
- 在以下程序第一行的下划线处填写doublemax,使程序能正确运行。#include ____________(double,double )voidmain(){doublex,y;scanf('%lf%lf',&x,&y);printf('%lf',max(x,y));}doublemax(doublea,doubleb){return(a>b?a:b);}
- 1.如下程序输出的结果是:()。#include <;stdio.h>;void main(){int a=1, b=2,max=0;if(a>;b)max=a;elsemax=b;printf("%d",max);} A: 1 B: 2 C: 3 D: 4
- 有如下程序:#include"stdio.h"int max(x,y)int x,y;{int z;if(x>;y) z=x;else z=y;return(z);}main(){extern int a,b;printf(”max=%d\n",max(a,b));}int a=3,b=5;运行结果为( )。 A: max=3 B: max=4 C: max=5 D: max=6
- 中国大学MOOC: 有如下程序#include <stdio.h>main(){ int a = 0, b = 1; if (++a == b++) printf("T"); else printf("F"); printf("a=%d,b=%d\n", a, b); printf("\n");}程序运行后的输出结果是( )