三、程序填空题.docVIP

  • 1010
  • 0
  • 约1.01万字
  • 约 12页
  • 2016-04-13 发布于天津
  • 举报
三、程序填空题

PART 1 程序填空题 1. 以下程序按每行5个数的格式输出1至n范围内能被7或17 整除的整数,并求出其和。 如输入:50 则输出: 7 14 17 21 28 34 35 42 49 Sum=247 源程序: #include stdio.h void main() { int i, n, ct=0, sum=0; scanf( %d, n ); for ( i=1; i=n; i++ ) if ( ____(1)_____ ) { printf( %d\t, i ); _____(2)_______; ct++; if ( ___(3)______ ) printf( \n ); } printf( \nSum=%d\n, sum ); } 2. 以下程序输入10个整数到a数组,找到并输出其中最大的整数及其下标。 如输入:80 290 150 520 330 -160 -99 0 200 9 则输出:a[3]=520 源程序: #include stdio.h #define N 10 int get_max_index( int a[], int n ) { int i, k=0; for ( i=1; in; i

文档评论(0)

1亿VIP精品文档

相关文档