以下程序的功能:从键盘上输入若干学生的成绩,统计并输出最高成绩和最低成绩,当输入负数时结束输入。填空,使程序正确。
void main( )
{ float x,amax,amin;
scanf("%f",&x);
amax=x; amin=x;
while ()
{ if ( x>amax ) amax=x;
if () amin=x;
}
printf("\namax=%f\namin=%f\n",amax,amin);
}
下面程序的功能是输出1—100当中,每位数的乘积大于每位数的和的数,请填空。
#include
main()
{ int n,k=1,s=0,m;
for(n=1;n<=100;n++)
{ k=1;s=0;
;
While( )
{ k*=m%10;
S+=m%10;
; }
if(k>s) printf(“%d”,n);}}
写出以下程序的执行结果
#include "stdio.h"
main()
{ int a[]={1,2,3,-4,5};
int m,n,*p;
p=&a[0];
m=*(p+2);
n=*(p+4);
printf(“*p=%d,m=%d,n=%d\n”,*p,m,n);
}
已知:char c=’A’; int i=1,j; 执行语句j=!c&&i++; 则i和j的值是( )
A)1,1 B)1,0 C)2,1 D)2,0
在C程序中,语句之间必须要用分号“;”分隔。( )
选择答案:查看解析