下面程序的运行结果是( )。#include [stdio.h]main(){ int a=12, b= -34, c=56, min=0; min=a; if(min>b) min=b; if(min>c) min=c; printf("%d", min);}
A: 12
B: -34
C: 56
D: 0
A: 12
B: -34
C: 56
D: 0
举一反三
- 读程序题:#include <;stdio.h>;main(){ int a=12, b= -34, c=56, min=0;min=a;if(min>;b)min=b;if(min>;c)min=c;printf("min=%d", min);}运行结果为:
- main() {int a=12,b=-34,c=56,min=0; min=a; if(min>b) min=b; if(min>c) min=c; printf("min=%d",min); } 输出结果为:
- 下列程序的运行结果为:( ) #include int main() { int a = 3,b = 8,c = 9,d = 2,e = 4; int min; min = (a < b) ? a : b; min = (min < c) ? min : c; min = (min < d) ? min : d; min = (min < e) ? min : e; printf("Min is%d\n",min); }
- 设计一个函数,求一个数组中的最大值和最小值。并在主函数中调用它。 #include void fun1(int [],int,int *,int *);void main(){ int a[5]={45,22,54,7,12}; int max,min; _________ ; printf("max=%d,min=%d ",max,min); } void fun1(int a[],int n,int *max,int *min){ int i; *max=a[0]; *min=a[0]; for(i=1;i if( ____ ) *max=a[i]; if( ____ ) *min=a[i]; }}在划线处填上正确的选项( )。[/i][/i] A: fun1(a,5,max,min),*maxa[i] B: fun1(a,5,&max,&min),maxa[i] C: fun1(a,5,&max,&min),*max>a[i],*min D: fun1(a,5,&max,&min),*maxa[i]
- 求两个正整数x和y的最小公倍数,请填空。 #include "stdio.h" int main { int x = 24, y = 31, t, min, i; if(x > y) {t = x; x = y; y = t;} for (________; i >= y; i--) { if(________) min = i; } printf("min is : %d", min); return 0; }