有以下程序
#include <stdio.h>
fun(int x)
{ if(x/2>0) f un(x/2);
printf("%d ",x);
}
main()
{ fun(6);printf("\n"); }
程序运行后的输出结果是 【 1 5 】 。
第1题:
下面程序的运行结果是( )。
include<stdio.h>
main()
{int a=25;
fun(&A);
}
fun(int *x)
{ printf("%d\n",++*x);
}
第2题:
以下程序的输出结果是( )。 #include<stdio.h> int fun(int n,int *s) { int f1,f2; if(n==0||n==1) *s=1; else { fun(n-1,&f1); fun(n-2,&f2); *s=f1+f2; } } void main() { int x; fun(6,&x); printf("\n%d" ,x);}
A.7
B.13
C.9
D.10
第3题:
有以下程序 #include <stdio.h> int f(int x) { int y; if(x==0||x==1) return(3); y=x*x-f(x-2); return y; } main() { int z; z=f(3); printf("%d\n",z); } 程序的运行结果是
A.0
B.9
C.6
D.8
第4题:
下列程序的输出结果是【 】。
include <stdio.h>
void fun(int x)
{
if(x/2>0) fun(x/2);
printf("%d",x);
}
main()
{
fun(3);printf("\n");
}
第5题:
有以下程序: #include<stdio.h> #define N 8 void fun(int*x,int i) {*x=*(x+i)+1;} main() {int a[N]={1,2,3,4,5,6,7,8},i; fun(a,2); for(i=0;i<N/2;i++) {printf("%d",a[i]);} printf("\n"); } 程序运行后的输出结果是( )。
A.1 3 1 3
B.3 2 3 4
C.4 2 3 4
D.1 2 3 4
第6题:
写出以下程序的执行结果。#include "stdio.h" void f13(int y,int *x) { y=y+*x; *x=*x+y; } int main() { int x=2,y=4; f13(y,&x); printf("%d,%dn",x,y); return 0; }