以下程序运行完后s的值是____. #include <stdio.h> int main() { int n ; float s=1.0; for(n=5;n>1;n--) s=s+1/n; printf("%0.1fn",s); return 0; }

以下程序运行完后s的值是____. #include <stdio.h> int main() { int n ; float s=1.0; for(n=5;n>1;n--) s=s+1/n; printf("%0.1fn",s); return 0; }


参考答案和解析
efgh 函数*ss的作用是使字符串指针往后移strlen(s)/2个位置。形参指针a指向字符串'abcdefeh',调用函数*ss后,指针指向e,所以输出为efgh。

相关考题:

有以下程序include stdio.hint fun(char s[]){ int n=0;while(*s='9'stdio.hint fun(char s[]){ int n=0;while(*s='9'*s='0') {n=10*n+*s-'0';s++;}return(n);}main(){ char s[10]={ '6', '1', '*', '4', '*', '9', '*', '0', '*'};printf("%d\n",fun(s));}程序运行的结果是A ) 9B ) 61490C ) 61D ) 5

( 33 )有以下程序#include studio.hint f ( int t[],int n ) ;main{ int a[4]={1,2,3,4},s;s=f ( a,4 ) ; printf ( " %d\n " ,s ) ;}int f ( int t[],int n ){ if ( n0 ) return t[n-1]+f ( t,n-1 ) ;else return 0 ;}程序运行后的输出结果是A ) 4B ) 10C ) 14D ) 6

34 ) 有以下程序#include stdio.hint f(int n);main(){ int a=3,s;s=f(a);s=s+f(a);printf("%d\n",s);}int f(int n){ static int a=1;n+=a++;return n;}程序运行以后的输出结果是A)7B)8C)9D)10

有以下程序#include stdio.hint fun(char s[]){ int n=0;while(*s=′9′*s=′0′) {n=10*n+*s-′0′;s++;}return(n);}main(){ char s[10]={′6′,′1′,′*′,′4′,′*′,′9′,′*′,′0′,′*′};printf("%d\n",fun(s));}程序的运行结果是A.9B.61490C.61D.5

有以下程序:includedstdio.hint f(int n); main( ){int a=3,s; s=f(a);s=s+f(a);printf(int f(int n);main( ){int a=3,s;s=f(a);s=s+f(a);printf(%dkn,s);}int f(int n){static int a=1;n+=a++;return n;}程序运行后的输出结果是( )。A.7B.8C.9D.10

以下程序的输出结果是【 】。include defineN 5 int fun(int *s,int a,int n) {int j; *s= 以下程序的输出结果是【 】。include <stdio.h>define N 5int fun(int *s,int a,int n){ int j;*s=a j=n;while(a!=s[j]) j-;return j;main(){ int s[N+1]; int k:for(k=1 ;k<=N;k++) s[k]=k+1:print f("%d\n",fun(s,4,N));}

以下程序的功能是计算:。includemain(){int n; float s; s=1.0; for(n=10;n>1;n--)s=s+ 以下程序的功能是计算:。#include <stdio.h> main() { int n; float s; s=1.0; for(n=10;n>1;n--) s=s+1/n; printf("%6.4f\n",s); } 程序运行后输出结果错误,导致错误结果的程序行是( )。A.s=1.0;B.for(n=10;n>1;n--)C.s=s+1/n;D.printf("%6.4f\n",s);

要求以下程序的功能是计算main () { int n; float s; S=1.0; for (n=10; n>1; n--) s=S+1/n; printf("%6.4f\n",S); } 程序运行后输出结果错误,导致错误结果的程序行是A.s=1.0;B.for(n=10;n>1;n--)C.s=s+1/n;D.prind("%6.4f\n",s);

阅读以下说明和C语言函数,将应填入(n)处的字句写在对应栏内。[说明]编写一个函数,输入为偶数时,调用函数求1/2+?/+…+1/n,当输入n为奇数时,调用函数1/1+1/3+…+1/n (利用指针函数)。[函数]include "stdio. h",main(){float peven (),podd (),dcall ();float sum;int n;while (1){scanf("%d",n);if (n>1)break;}if(n%2==0){printf("Even="):(1);}else{pfinff("Odd=");(2);}printf("%f",sum);}float peven (int n){float s;int is=1;for(i=2;i<=n;i+=2)(3);return (s);}float podd (n)int n;{float s;int i;s=0;for(i=1 i<=n;i+=2)(4);return (s);}float dcall(fp,n)float (*fp) ();int n;{float s;(5);returu (s);}

要求以下程序的功能是计算:s=1+1/2+1/3+…+…1/10main( ){ int n; float s;s=1.0;for(n=10;n1;n--)s=s+1/n;printf("%6.4f\n",s);}程序运行后输出结果错误,导致错误结果的程序行是A.s=1.0;B.for(n=10;n1;n--)C.s=s+1/n;D.printf("%6.4f\n",s);

下面程序的运行结果是[]。include int f(int a[],int n){ if(n>1)return a[0]+f(a+1,n-1 下面程序的运行结果是[ ]。include <stdio.h>int f(int a[],int n){ if(n>1)return a[0]+f(a+1,n-1);elsereturn a[0];}main(){int aa[10]={12,3,4,5,6,7,8,9,10},s;s=f (aa+2,4); printf("%d\n",s); }

有以下程序 include int fun(char s[]) { int n=O; whil 有以下程序 #include <stdio.h> int fun(char s[]) { int n=O; while(*s<='9'*s>='0') { n=10*n+*s-'0'; s++; } return (n); } main() { char s[10]={ '6', '1', '*', '4', '*', '9', '*', '0', '*'}; printf("%d\n",fun(s)); }A.9B.61490C.61D.5

要求以下程序的功能是计算main() {int n;float s; s=1.0; for(n=10;n>1;n--) s=s+1/n; pfintf("%6.4f\n",s); } 程序运行后输出结果错误,导致错误结果的程序行是A.s=1.0;B.for(n=10;n>1;n--)C.s=s+1/n;D.printf("%6.4f\n",8);

有以下程序includeintfun(chars[]){intn=0;while(*s='0'){n=10*n+* 有以下程序 #include <stdio.h> int fun(char s[]) { int n=0; while(*s<='9'*s>='0') {n=10*n+*s-'0';s++;} return(n); } main() {char s[10]={'6','1','*','4','*','9','*','0','*'}; printf("%d\n",fun(s)); } 程序的运行结果是A.9B.61490C.61D.5

有以下程序:includeint a=2;int f(int *a){return (*a) ++;}main(){ int s=0;{ int a= 有以下程序: #include <stdio.h> int a=2; int f(int *a) { return (*a) ++;} main() { int s=0; { int a=5; s+=f(a); } s+=f(a); printf("%d\n",s) } 执行后的输出结果是( )。A.10B.9C.7D.8

下面程序的运行结果是( )。 include main() {int a,s,n,m; a=2;s=0;n=1;m=1; while(m 下面程序的运行结果是( )。 include<stdio.h> main() {int a,s,n,m; a=2;s=0;n=1;m=1; while(m<=4){n=n*a;s=s+n;++m;} printf("s=%d",s); }

要求以下程序的功能是计算s=1+1/2+1/3+…+1/10 main() { int n; float s; s=1.0; for(n=1O;n>1;n--) s=s+1/n; printf("%6.4f\n",s); } 程序运行后输出结果错误,导致错误结果的程序行是( )。A.s=1.0;B.for(n=1O;n>l;n--)C.s=s+1/n;D.printf("%6.4f\n",s);

有以下程序#inculde stdio.hint F(int t[],int n);main(){ int a[4]=(1,2,3,4),s;s =F(a,4);printF(“%d\n”,s);}int F(int t[],int n){ iF(n0) return t[n-1]+F(t,n-1);Else return 0;}程序运行后的输出结果是A.4B.10C.14D.6

有以下程序includevoid fun(float* p1,int n1,float,*p2,int n2,float* s){ int i;s=( 有以下程序 #include<stdio.h> void fun(float * p1,int n1,float,*p2,int n2,float * s) { int i; s=(float *)calloc(1,sizeof(float)); *s=0; for(i=0;i<n1;i++) *s+=*p1++; for(i=0;i<n2;i++) *s+=*p2++; } main() { float a[2]={1.1,2.2},b[3]={10.0,20.0,30.0),*s=a; fun(a,2,b,3,s); printf("%f\n",*s); } 上面程序的输出结果是( )A.60B.3.3C.63.3D.1.1

有以下程序includevoid main(){char s[]={"01aXy"};int i,n=0;for(i=0;s[i]!=0;i++)if 有以下程序 #include<stdio.h> void main() { char s[]={"01aXy"};int i,n=0; for(i=0;s[i]!=0;i++) if(s[i]<='a's[i]>='z')n++; printf("%d\n",n); } 程序运行后的输出结果是( )。A.0B.2C.3D.5

有以下程序:includeint f(int t[],int n);main(){int a[4]={1,2,3,4},s;s=f(a,2);prin 有以下程序: #include<stdio.h> int f(int t[],int n); main() {int a[4]={1,2,3,4},s; s=f(a,2);printf("%d\n",s); } int f(int t[],int n) {if((n>0)(n<5))return t[n+1]+f(t,n-1); else return 0; } 程序运行后的输出结果是( )。A.4B.7C.10D.61

有以下程序 include int fun(char s[ ]) { int n=0; while(*s='0 有以下程序#include <stdio.h>int fun(char s[ ]){ int n=0;while(*s<='9'*s>='0') {n=10*n+*s-'0';s++;}retum(n);}main( ){ char s[10]={'6','1','*','4','*','9','*','0','*'};printf("%d\n",fun(s));}程序的运行结果是A.9B.61490C.61D.5

有以下程序: #includestdio.h int f(int t[],int n); main( ) {int a[4]={1,2,3,4},s; s=f(a,4);printf("%d\n",s); int f(int t[],int n) {if(n0)return t[n-1]+f(t,n-1); else return 0; } 程序运行后的输出结果是( )。A.4B.10C.14D.6

有以下程序:includemain(){int s=0,a=1,n; scanf("%d",n); do {s+=1;a=a-2;} whi 有以下程序: #include <stdio.h> main() { int s=0,a=1,n; scanf("%d",n); do {s+=1;a=a-2;} while(a!=n); printf("%d\n",s); } 若要使程序的输出值为2,则应该从键盘给n输入的值是( )。A.-1B.-3C.-5D.0

有以下程序:includeint fun(char s[]){ intn=0;while(*s='0'){n=10 有以下程序: #include <stdio.h> int fun(char s[]) { int n=0; while(*s<='9'*s>='0') {n=10*n+*s-'0';s++;} return(n); } main() { char s[10]={'6','1','*','4','*','9','*','0','*'}; printf("%d\n",fun(s)); } 程序的运行结果是( )。A.9B.61490C.61D.5

单选题有以下程序:#include int f(int n);main(){ int a=3,s; s=f(a); s=s+f(a); printf(%d,s);}int f(int n){ static int a=1; n+=a++; return n;}程序运行以后的输出结果是(  )。A7B8C9D10

单选题有以下程序:#include int f(int t[],int n);main(){ int a[4]={1,2,3,4},s; s=f(a,4); printf(%d,s);}int f(int t[],int n){ if(n0)return t[n-1]+f(t,n-1); else return 0;}程序运行后的输出结果是(  )。A4B10C14D6

单选题有以下程序#include int fun(char s[]){ int n=0; while(*s='0') {  n=10*n+*s-'0';  s++; } return (n);}main(){ char s[10]={'6','1','*','4','*','9','*','0','*'}; printf("%d",fun(s));}程序的运行结果是(  )。A61490B61C9D5