以下程序的功能是计算字符串的长度。请填空。#include<stdio.h>main(){char str[100],*sp=str;int
以下程序的功能是计算字符串的长度。请填空。
#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()
{char str[100],*sp=str;
int nlen=0;
scanf("%s",str);
for(;*sp!='\0';sp++)______;
printf("%d",nlen);
}
以下程序的功能是计算:s=1+12+123+1234+12345。请填空。
main()
{intt=0,s=0,i;
for(i=1;i<=5;i++)
{t=i+______;s=s+t;}
printf("s=%d\n",s);
}
下面程序的功能是将字符串s中所有的字符a删除。请填空。
#include<stdio.h>
void main()
{char s[80];
int i,j=0;
gets(s);
for(i=0;s[i]!='\0';i++)
if(s[i]!='a')______;
s[j]='\0';
puts(s);}
下面程序的功能是统计字符串中“广的个数,请填空。 Sub COU() a$="Beijing University of Technology" Dim n AS Integer n=Len(a$) For i=1 To n b$=【 】 If【 】Then x=x+1 Next i Print "x=";x End Sub
以下程序能将字符串Program!反向打印出来,请填空。
#include<stdio.h>
void out(char *str)
{char *s=______;/*第一空*/
if(*s==NULL)return:
while(______)s++;/*第二空*/
s--;
printf("%c\n",*s);
______=NULL;/*第三空*/
out(str);
}
main()
{char c[]="Program!";
out(c);}
以下程序的功能是求下列算式中A、B、C的值,请填空。
include <stdio.h> main() { int a,b,c,k,t=348; for(a=0;a<10;a++) for(b=0;b<10;b++) for(c=0;【 】;c++) { k=【 】; if(k==t) printf("A=%d B=%d C=%d\n",a,b,c); } }
下列程序中,函数fun的功能是:根据整型形参m的值,计算如下公式的值:t=1-1/(2×2)-1/(3×3)-…-1/(m×m)请填空。
#include<conio.h>
#include<stdio.h>
double fun(int m)
{double y=1.0;int i;
for(______)
y-=1.0/(i*i);
return(y);
}
main()
{int n=5;
printf("\nThe result is%1f\n",fun(n));}
以下程序是计算10名学生1门课成绩的平均分。请填空。
#include<stdio.h>
float average(float array[10])
{int i;float aver,sum=array[0];
for(i=1;i<10;i++)sum+=______;
aver=sum/10;
return(aver);
}
main()
{float score[10],aver;
int i;
printf("\n input 10 scores:");
for(i=0;i<10;i++)scanf("%f",&score[i]);
aver=average(score);
printf("\n average score is%5.2f\n",aver);
}