更多"下面程序的功能是:计算1~20之间的奇数之和与偶数之和,请填空使程序功"的相关试题:
[填空题]下面程序的功能是:计算1~20之间的奇数之和与偶数之和,请填空使程序功能完整。
#include<stdio.h>
main( )
{int a=0,b=0,c=0,i;
for(i=0;i<=20;i+=2)
{ a+=i;
______;
c+=b;
}
printf("偶数之和=%d/n",a);
printf("奇数之和=%d/n",c-21);
}
[填空题]下面程序的功能是:计算1~10之间的奇数之和与偶数之和,请填空。
#include <stdio.h>
main( )
{ int a,b,c,i;
a=c=0;
for(i=0;i<=10;i+=2)
{ a+=i;
______;
c+=b;}
printf("偶数之和=%d/n",a);
printf("奇数之和=%d/n",c-11);}
[填空题]下面程序的功能是:计算1~10之间的奇数之和与偶数之和,请填空。
#include<stdio.h>
main( )
int a,b,c,i;
a=c=0;
for(i=0;i<=10;i+=2)
a+=i;
______;
c+=b;
printf("偶数之和=%d",a);
printf("奇数之和=%d",c-11);
[填空题]下面程序的功能是:计算1~10之间奇数和及偶数之和。
#include <stdio.h>
main ( )
int a, b, c, i;
a=c=O;
for (i=O; i<=10;i+=2)
a+=i; 【5】 ;
c+=b;
printf("偶数之和=%d/n",a);
printf("奇数之和=%d/n",c-11);
[填空题]以下程序的功能是计算字符串的长度。请填空。
#include<stdio.h>
main( )
{char str[100],*sp=str;
int nlen=0;
scanf("%s",str);
for(;*sp!=’/0’;sp++)______;
printf("%d",nlen);
}
[填空题]下面程序的功能是用来统计文件中字符个数。请填空。
#include"stdio.h"
main( )
long count=OL;
FILE*fp= 【16】 ("text.dat","r");
if(fp==0)
printf("Open error/n");
exit(0);
while( 【17】 )
fgetc(fp);
count++;
fclise(fp);
printf("%1d/n",count);
[填空题]下面程序的功能是输出数组s中最小元素,请填空。
#include<iostream.h>
void main( ){
int k, p, s[]={1,-9,7,2,-10,3};
k=s[0];
for(p=0;p<6;p++)
if(s[p]<k) [11] ;
cout<<k;
}
[填空题]下面程序的功能是输出数组s中最小元素,请填空。
#include<iostream.h>
void main( )
int k, p, s[]=1,-9,7,2,-10,3;
k=s[0];
for(p=0;p<6;p++)
if(s[p]<k) [11] ;
cout<<k;
[填空题]下面程序的功能是输出数组s中最大元素的下标,请填空。
#include <stdio.h>
main( )
{ int k, p,s[]={1, -9,7,2, -10,3};
for(p =0,k =p; p<6; p++)
if(s[p]>s[k]) 【13】
printf("%d/n", k);
}
[填空题]下面程序的功能是将一个字符串str的内容颠倒过来,请填空。
#include<string.h>
main( )
{ infi,j, [13] ;char str[]={"1234567"};
for(i=0,j=strlen(str) [14] ;i<j;i++,j--)
{k=str[i];str[i]=str[i];str[j]=k;}
printf("%s/n",str);}
[填空题]下面程序的功能是将一个字符串sfr的内容颠倒过来,请填空。
#include<string.h>
main( )
int i,j, (13) ;char str[]="1234567";
for(i=0,j=strlen(str) (14) ;i<j;i++,j--)
k=str[i];str[i]=str[j];str[j]=k;
printf("%s/n",str);