对于以下程序,当执行完第8行break语句后,接下来将执行哪一行语句? 1 for(i=n;i<=m;i++) 2 { 3 for(j=2;j<i;j++) 4 { 5 if(!(i%j)) 6 { 7 isPrime=0; 8 break; 9 printf(“是素数”); 10 } 11 } 12 isPrime=1; 13 } 14 printf(“不是素数”);A.12B.14C.3D.8E.9
对于以下程序,当执行完第8行break语句后,接下来将执行哪一行语句? 1 for(i=n;i<=m;i++) 2 { 3 for(j=2;j<i;j++) 4 { 5 if(!(i%j)) 6 { 7 isPrime=0; 8 break; 9 printf(“是素数”); 10 } 11 } 12 isPrime=1; 13 } 14 printf(“不是素数”);
A.12
B.14
C.3
D.8
E.9
参考答案和解析
C
相关考题:
有以下程序#include stdio.hvoid fun(int *a,int n)/*fun 函数的功能是将 a 所指数组元素从大到小排序 */{ int t,i,j;for(i=0;in-1;i++)for(j=i+1;jn;j++)if (a[i]a[j]) {t=a[i];a[i]=a[j];a[j]=t;}}main(){ int c[10]={1,2,3,4,5,6,7,8,9,0},i;fun(c+4,6);for (i=0;i10;i++) printf("%d,",c[i]);printf("\n");}程序运行的结果是A ) 1,2,3,4,5,6,7,8,9,0,B)0,9,8,7,6,5,1,2,3,4,C) 0,9,8,7,6,5,4,3,2,1,D)1,2,3,4,9,8,7,6,5,0,
( 9 )有以下程序#include stdio.hmain (){ int i,j,a[][3]={1,2,3,4,5,6,7,8,9};for ( i=0;i3;i++ )for ( j=i;j3;j++ ) printf ( " %d%,a[i][j] ) ;printf ( " \n " ) ;}程序运行后的输出结果是 【 9 】 。
以下程序运行后的输出结构是。main(){ int i,j,a[][3]={1,2,3,4,5,6,7,8,9}; for(i=0;i3;i++) for(j=i;j3;j++)a[j][i]=0; for(i=0;i3;i++) { for(j=0;j3;j++) printf("%d ",a[i][j]); printf("\n"); }}
有以下程序#include stdio.hvoid fun(int *a,int n)/*fun函数的功能是将a所指数组元素从大到小排序*/{ int t,i,j;for(i=0;in-1;j++)for(j=i+1;jn;j++)if(a[i]a[j]) { t=a[i];a[i]=a[j];a[j]=t;}}main(){ int c[10]={1,2,3,4,5,6,7,8,9,0},i;fun(c+4,6);for(i=0;i10;i++) printf("%d,",c[i]);printf("\n");}程序的运行结果是A.1,2,3,4,5,6,7,8,9,0,B.0,9,8,7,6,5,1,2,3,4,C.0,9,8,7,6,5,4,3,2,1,D.1,2,3,4,9,8,7,6,5,0,
阅读下列函数说明和C代码,填入(n)处。[说明]以下C语言程序实现了生成从里到外是连续的自然数排列的回旋矩阵,矩阵形式如下:7 6 5 168 1 4 159 2 3 1410 11 12 13程序的变量说明如下:x1:矩阵上边界;x2:矩阵下边界;y1:矩阵左边界;y2:矩阵右边界;s:数组元素升降标记,s等于1为升,s等于-1为降;a[]:存放矩阵元素的数组。仔细阅读C语言程序源码,将(n)处的语句补充完整。(注:每处仅一个语句)[C程序]include<stdio.h>void main ( ){const int N=20;int i=0,j=0,a[N][N],n;int m,x1,x2,y1,y2,s;while (1){Printf ("\ninput matrix row N( N>=2): ");scanf ("%d",n);printf ("\n");if (n>=2)break;}m=n*n;x1=0; y1=0; x2=n; y2=n;if(n%2==0){j=n-1; y2=n-1; s=1;}else{i=n-1; y1=1; s=-1; }while (1){if (s==1){for (i; i<x2; i++) a[i][j]=m--;i--;j--;(1)for (j;j>=y1;j--) a[i][j]=m--;j++;i--;y1++;(2)}else{for (i;i>=x1;i--)a[i][j]=m--;i++;j++;(3)for (j;j<y2;j++)(4)(5)i++;(6)S=i;}if (m<1) break;}for (i=O;i<n; i++){for (j=O;j<n;j++)printf ("%6d",a[i][j]);printf ("\n");}printf ("\n");}
以下程序的执行结果是______。 main() { int i,j,m=O,n=0; for (i=0;i<2;i++) {for (j=0;j<2;j++) if(j>=i) m=1;n++; printf("%d\n",n); } }A.4B.2C.1D.0
有以下程序:include main( ){int num[4][4]={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13;1 有以下程序: #include <stdio.h> main( ) { int num[4][4]={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13;14,15,16}},i,j; for(i =0;i<4;i ++ ) { for(j=0;j<=i;j++)printf("%4c","); for(j=______;j<4;j ++ )printf( "%4d" ,hum[i] [j] ); printf(" \n" ); } } 若要按以下形式输出数组右上半三角; 1 2 3 4 6 7 8 11 12 16则在程序下划线处应填入的是( )。A.i-1B.iC.i+1D.4-i
以下程序中函数sort的功能是对a所指数组中的数据进行由大到小的排序: float sort(int a[], int n) { int i, j, t; for(i=0; i<n-1; i++) for(j=i+1; j<n; j++) if(a[i]<a[j]){t=a[i]; a[i]=a[j]; a[j]=t; } } main() { int aa[10]={1, 2, 3, 4, 5, 6, 7, 8, 9, 10), i; sort(aa[3], 5); for(i=0; i<10; i++)printf("% d", aa[i]); printf ("\n"); } 程序运行后的输出结果是______。A.1, 2, 3, 4, 5, 6, 7, 8, 9, 10B.10, 9, 8, 7, 6, 5, 4, 3, 2, 1C.1, 2, 3, 8, 7, 6, 5, 4, 9, 10D.1, 2, 10, 9, 8, 7, 6, 5, 4, 3
有以下程序: void sort(int a[],int n) { int i,j,t; for(i=0;i<n;i++) for(j=i+1;<n;j++) if(a[i]<a[j]){ t=a[i]; a[i]=a[j]; a[j]=t; } } main() {int aa[10]={1,2,3,4,5,6,7,8,9,10},i; sort(aa+2,5); for(i=0;i<10;i++)printf("%d,",aa [i]); printf("\n"); } 程序运行后的输出结果是 ______ 。A.1,2,3,4,5,6,7,8,9,10,B.1,2,7,6,3,4,5,8,9,10,C.1,2,7,6,5,4,3,8,9,10,D.1,2,9,8,7,6,5,4,3,10,
以下程序中,函数sort的功能是对a数组中的数据进行由大到小的排序。void sort(int a[],int n){ int i,j,t; for(i=0;in-1;i++) for(j=i+1;jn;j++) if(a[i]a[j]) { t=a[i];a[i]=a[j];a[j]=t;}}main(){ int aa[10]={1,2,3,4,5,6,7,8,9,10},i; sort(aa[3],5); for(i=0;i10;i++)printf("%d,",aa[i]); printf("\n");}程序运行后的输出结果是A.1,2,3,4,5,6,7,8,9,10B.10,9,8,7,6,5,4,3,2,1C.1,2,3,8,7,6,5,4,9,10D.1,2,10,9,8,7,6,5,4,3
include void sort(inta[],int n) {int i,j,t;for(i=0;i include<stdio.h>void sort(inta[],int n){int i,j,t;for(i=0;i<n-1;i++)for(j=i+1;<n;j++)if(a[i]<a[j]){t=a[i];a[i]=a[j];a[j]=t;}}main(){int a[10]={1,2,3,4,5,6,7,8,9,10},i;sort(a[1],7);for(i=0;i<10;i++)printf("%d,",a[i]);}程序运行后的输出结果是( )。A.1,2,3,4,5,6,7,8,9,10,B.10,9,8,7,6,5,4,3,2,1,C.1,8,7,6,5,4,3,2,9,10,D.1,2,10,9,8,7,6,5,4,3,
有以下程序 #includestdio.h void fun(int*a,int n)/*fun函数的功能是将a所指数组元素从大到小排序*/ {int t,i,j; for(i=0;in-1;j++) for(j=i+l;jn;j++) if(a[i]a[j]){t=a[i];a[i]=a[j];a[j]=t;} } main {int c[10]={1,2,3,4,5,6,7,8,9,0),i; fun(c+4,6); for(i=0;i10;i++)printf("%d,",c[i]); printf("\n"); } 程序运行的结果是( )。A.1,2,3,4,5,6,7,8,9,0,B.0,9,8,7,6,5,1,2,3,4,C.0,9,8,7,6,5,4,3,2,1,D.1,2,3,4,9,8,7,6,5,0,
以下程序中函数sort的功能足对a数组中的数据进行由大到小的排序 void sort(int a[],int n) {int i,j,t; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(a[i]<a[j]){t=a[i];a[i]=a[j];a[j]=t;} } main() {int aa[10]={1,2,3,4,5,6,7,8,9,10},i; sort(aa[3],5); for(i=0;i<10;i++)printf("%d,",aa[i]); printf("\n"); } 程序运行后的输出结果是( )。A.1,2,3,4,5,6,7,8,9,10,B.1 0,9,8,7,6,5,4,3,2,1,C.1,2,3,8,7,6,5,4,9,10,D.1,2,10,9,8,7,6,5,4,3,
有以下程序: main() {int num[4][4]={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}},ij; for(i=0;i<4;i++) { for(j=0;j<=i;j++) printf("%4c",'); for(j=______;j<4;j++) printf("%4d",num[i][j]); printf("\n"); } } 若要按以下形式输出数组右上半三角 1 2 3 4 6 7 8 11 12 16 则在程序下划线处应填入的是 ______ 。A.i-1B.iC.i+1D.4-i
以下程序中函数sort的功能是对a所指数组中的数据进行由大到小的排序: void sort(int a[],int n) {int i,j,t; for(i=0;i<n-1;i++) for(j=i+1;i<n;j++) if(a[i]<a[j]) {t=a[i];a[i]=a[j];a[j]=t;} } main() {int aa[10]={1,2,3,4,5,6,7,8,9,10},i; sort(aa[3],5); for(i=0;i<10;i++) printf('%d,",aa[i]); printf("\n"); } 程序运行后的输出结果是( )。A.1,2,3,4,5,6,7,8,9,10,B.10,9,8,7,6,5,4,3,2,1,C.1,2,3,8,7,6,5,4,9,10,D.1,2,10,9,8,7,6,5,4,3,
有下列程序:void sort(int a[],int n){ int i,j,t;for(i=0;in-l;i++)for(j=i+1;jn;j++)if(a[i]a[j]){t=a[i];a[i]一a[j];a[j]=t;}}main{ int aa[10]:{1,2,3,4,5,6,7,8,9,10),i;sort(aa+2,5);for(i=0;i10;i++)printf(%d,,aa[i]);printf(\n);}程序运行后的输出结果是( )。A.1,2,3,4,5,6,7,8,9,l0,B.1,2,7,6,3,4,5,8,9,10,C.1,2,7,6,5,4,3,8,9,10,D.1,2,9,8,7,6,5,4,3,10,
有以下程序 vold soru(int a[], int n) { int i,i,t; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(a[i]<a[j]) { t=a[i]; a[i]=a[i]; a[j]=t; } } main() { int aa[10]={1,2,3,4,5,6,7,8,9,10),i; sore(aa+2, 5); for(i=0;i<10;i++) printf("%d,",aa[i]); printf("\n"); } 程序运行后的输出结果是A.1,2,3,4,5,6,7,8,9,10,B.1,2,7,6,3,4,5,8,9,10,C.1,2,7,6,5,4,3,8,9,10,D.1,2,9,8,7,6,5,4,3,10,
有以下程序void sort(int a[],int n){ int i,j,t; for(i=0;in-1;i+=2) for(j=i+2;jn;j+=2) if(a[i]a[j]) { t=a[i]; a[i]=a[j]; a[j]=t; }}main(){ int aa[10]={1,2,3,4,5,6,7,8,9,10},i; sort(aa,10); for(i=0;i10;i++) printf("%d,",aa[i]); printf("\n");}执行后的输出结果是A.1,2,3,4,5,6,7,8,9,10, B.10,9,8,7,6,5,4,3,2,1, C.9,2,7,4,5,6,3,8,1,10 D.1,10,3,8,5,6,7,4,9,2,
若有以下程序main(){ int a[4][4]={{1,2,-3,-4},{0,-12,-13,14},{-21,23,0,-24},{-31,32,-33,0}}; int i,j,s=0; for(i=0;i4;i++) { for(j=0;j4;j++) { if(a[i][j]0) continue; if(a[i][j]==0) break; s +=a[i][j]; } } printf("%d\n",s);}程序执行后的输出结果是
有以下程序 main() { int num[4][4]={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}},i,j; for(i=0;i<4;i++) { for(j=0; j<=i;j++) printf("%4c","); for(j=______;j<4;j++) printf("%4d",num[i][j]); printf("\n"); } } 若要按以下形式输出数组右上半三角 1 2 3 4 6 7 8 11 12 16 则在程序下划线处应填入的是______。A.i-1B.iC.i+1D.4-i
有以下程序main ( ){ int num[4] [4]={{1,2,3,4},{5,6,7,8}, {9,10,11,12}, {13,14,15,16}},i, j; for (i=0;i<4; i++) { for(j=1; j<=i; j++) printf ("%4c",' '); for(j=______;j<4;j++) printf ( "%4d', num [i] [j] ); printf ( "\n" ); }} 若要按下形式输出数组右上半三角 1 2 3 4 6 7 8 11 12 16A.i-1B.iC.i+1D.4-i
有以下程序:main{ int num[4][4]={1,2,3,4},{5,6,7,8},{9,10,11,12,},{13,14,15,16}},i,j;for(i=0;i4;i++){ for(j=0;ji;j++)printf(%4c,);for(j=________;J4;j++)printf(%4d,num[i][j]);printf(\n);}}若要按以下形式输出数组右上半三角1 2 3 46 7 811 1216则在程序下划线处应填入的是( )。A.i-1B.iC.i+1D.4一i
有以下程序: void sort(int a[], int n) {int i,j,t; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(a[i]<a[j]) { t=a[i]; a[i]=a[j]; a[j]=t; } } main() { int aa[10]={1,2,3,4,5,6,7,8,9,10},i; sort(aa+2,5); for(i=0;i<10;i++)printf("%d,",aa[i]); printf("\n"); } 程序运行后的输出结果是( )。A.1,2,3,4,5,6,7,8,9,10,B.1,2,7,6,3,4,5,8,9,10,C.1,2,7,6,5,4,3,8,9,10,D.1,2,9,8,7,6,5,4,3,10,
以下程序中函数sort的功能是对a数组中的数据进行由大到小的排序 void sort(int a[],int n) { int i,j,t; for(i=0;i<n-1;i++) for(j=i+1;<n;j++) if(a[i]<a[j]){t=a[i];a[i]=a[j];a[j]=t;} } main() { int aa[10]={1,2,3,4,5,6,7,8,9,10},i; sort(aa[3],5); for(i=0;i<10;i++)printf("%d,",aa[i]); printf("\n");} 程序运行后的输出结果是A.1,2,3,4,5,6,7,8,9,10,B.10,9,8,7,6,5,4,3,2,1,C.1,2,3,8,7,6,5,4,9,10,D.1,2,10,9,8,7,6,5,4,3,
有以下程序 include void fun(int *a,int n)/*fun函数的功能是将a所指数组元素从大到 有以下程序#include <stdio.h>void fun(int *a,int n)/*fun函数的功能是将a所指数组元素从大到小排序*/{ int t,i,j;for(i=0;i<n-1;j++)for(j=i+1;j<n;j++)if(a[i]<a[j]) { t=a[i];a[i]=a[j];a[j]=t;}}main( ){ int c[10]={1,2,3,4,5,6,7,8,9,0},i;fun(c+4,6);for(i=0;i<10;i++) printf("%d,",c[i]);printf("\n");}程序的运行结果是A.1,2,3,4,5,6,7,8,9,0,B.0,9,8,7,6,5,1,2,3,4,C.0,9,8,7,6,5,4,3,2,1,D.1,2,3,4,9,8,7,6,5,0,
有以下程序 main() {int num[4][4]={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}},i,j; for(i=0;i<4;i++) { for(j=0;j<=i;j++) printf("%4c","); for(j=______;j<4;j++) printf("%4d",num[i][j]); prrintf("\n"); } } 若要按以下形式输出数组右上半三角 1 2 3 4 6 7 8 11 12 16 则在程序下划线处应填入的是A.i-1B.iC.i+1D.4-i
有以下程序: void sott(int a[], int n) { int i, j, t; for(i=0; i<n-1; i++) for(j=i+1; j<n; j++) if(a[i]<a[j]){t=a[i];a[i]=a[j];a[j]=t;) } main() {int aa[10]={1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, I; sort(aa+2, 5); for (i=0; i<10; i++)printf("% d", aa[i]); printf("\n"); } 程序运行后的输出结果是______。A.1, 2, 3, 4, 5, 6, 7, 8, 9, 10,B.1, 2, 7, 6, 3, 4, 5, 8, 9, 10,C.1, 2, 7, 6, 5, 4, 3, 8, 9, 10,D.1, 2, 9, 8, 7, 6, 5, 4, 3, 10,
单选题有以下程序: #include #defineN4 voidfun(inta[][N]) { intb[N][N],i,j; for(i=0;i for(j=0;j b[i][j]=a[N-1-j][i]; for(i=0;i for(j=0;j a[i][j]=b[i][j]; } main() { intx[N][N]={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}},i; fun(x); fun(x); for(i=0;i printf("%d,",x[i][i]); printf(""); } 程序的运行结果是( )。A16,11,6,1,B1,6,11,16,C4,7,10,13,D13,10,7,4,