网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
设有双精度变量 score ,其值为 13.8。执行语句 n = (int)score % 3; 后,n 的值是:
A.1
B.4
C.4.333333
D.4.6
参考答案和解析
A
更多 “设有双精度变量 score ,其值为 13.8。执行语句 n = (int)score % 3; 后,n 的值是:A.1B.4C.4.333333D.4.6” 相关考题
考题
执行下列程序段之后,变量n的值为( )。 public class Test { public static void main(String[ ] args){ int y = 2; int z = 3; int n = 4; n=n+-y* z/n; System.out.println(n); } }A.3B.-1C.-12D.-3
考题
请编写函数fun(),该函数的功能是:计算n门课程的平均分,计算结果作为函数值返回。例如x有5门课程的成绩是90.5,72,80,61.5,55,则函数的值为71.80。注意:部分源程序给出如下.请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <stdio.h>float fun (float *a, int n){}main (){float score[30]=(90.5,72,80,61.5,55},aver;aver=fun(score, 5);printf("\nAverage score is: %5.2f\n",aver);}
考题
以下程序的功能是按顺序读入10名学生4门课程的成绩,计算出每位学生的平均分并输出:main( ){int n,k;float score,sum,ave;sum=0.0;for(n=1;n<=10;n++){for(k=1;k<=4;k++){cin>>score;sum+=score;}ave=sum/4.0;cout<<"NO"<<n<<":"<<ave<<endl;}}上述程序运行后结果不正确,调试中发现有一条语句出现在程序中的位置不正确。这条语句是A.sum=0.0B.sum+=scoreC.ave=sun/4.0D.cout<<"N0"<<n<<":"<<ave<<endl;
考题
执行下列程序段这后,变量n的值为______。 public class Test8 { public static void main(String[] args} { int y=2; int z=3; int n=4; n=n+-y*z/n; System.out.println (n); } }A.3B.-1C.-3D.-12
考题
设有以下宏定义: #define N 3 #define Y(n) ((N+1)*n)则执行以下语句后,z的值为______。 z=2*(N+Y(3+2));A.出错B.34C.46D.54
考题
执行下列程序段之后,变量n的值为( )。 public class Test { public static void main(String[ ] args){ int y = 2; int z = 3; int n = 4; n=n+-y* z/n; System. out. println(n); } }A.3B.-1C.-12D.-3
考题
以下程序的功能是:按顺序读入10名学生4门课程的成绩,计算出每位学生的平均分并输出,程序如下: main() { int n,k; float score,sum,ave; sum=0.0; for(n=1;n<=10;n++) { for(k=1;k<=4;k++) { scanf(“%f”,score);sum+=score;} ave=sum/4.0; printf(“NO%d:%f\n”,n,ave); } } 上述程序运行后结果不正确,调试中发现有一条语句出现在程序中的位置不正确。这条语句是A.sum=0.0;B.sum+=score;C.ave=sum/4.0;D.printf(“NO%d:%f\n”,n,ave);
考题
执行下面程序中的输出语句后,a的值是()。includemain(){int a; printf("%d\n",(a=3*5,a
执行下面程序中的输出语句后,a的值是( )。 #include <stdio.h> main() { int a; printf("%d\n",(a=3*5,a*4));A.15B.20C.10D.60
考题
以下程序的功能是:按顺序读入10名学生4门课程的成绩,计算出每个学生的平均分数并输出,程序如下: #include<iostream> using namespace std; int main( ) { int n,k; float score,sum,ave; sum = 0.0; for(n = 1;n <=10; n++) { for(k =1;k<=4;k++) { cin>>score; sum += score; } ave=sum/4.0; cout<<"NO."<<n<<"ave:"<<ave<<end1; } return 0; } 上述程序运行后结果不正确,调式中发现有一条语句出现在程序中的位置不正确。 这条语句是非曲直( )。A.sum=0.0;B.sum+=score;C.ave= sum/4.0D.cout<<"NO."<<n<<"ave:"<<ave<<end1;
考题
请填写 BOOL , float, 指针变量 与“零值”比较的 if 语句.提示:这里“零值”可以是 0, 0.0 , FALSE 或者“空指针”。例如 int 变量 n 与“零值”比较的 if 语句为:if ( n == 0 )if ( n != 0 )以此类推。请写出 BOOL flag 与“零值”比较的 if 语句:请写出 float x 与“零值”比较的 if 语句:请写出 char *p 与“零值”比较的 if 语句:
考题
执行下列程序之后,变量n的值为 publicclassExam{ publicstaticvoidmain(String[]args){ int y=2; int z=3; int n=4; n=n+-y*z/n; System.out.println(n); } }A.3B.-1C.-12D.-3
考题
单选题若“intn;floatf=13.8;”,则执行“n=(int)f%3”后,n的值是()A
1B
4C
4.333333D
4.6
热门标签
最新试卷