c语言考前复习 - 习题abi

printf(\}

int fun(int a,int b) { int f; if(a>b) f=1; else if(a==b) f=0; else f=-1; return f; } -1

(2)键盘输入 abcdef #include void fun( ) {

char c ;

if((c=getchar( ))!='\\n') fun( ) ; putchar(c);

}

void main( )

{ fun( ); } fedcba (3)

#include #define C 5 int x=1,y=C; void main( ) { int x;

x=y++; printf(\

if(x>4) { int x ; x=++y; printf(\ x+=y--;

printf(\} 5 6 7 7 12 6 (4)

}

#include int c , a=4 ; func(int a , int b)

{ c=a*b ; a=b-1 ; b++ ; return (a+b+1) ; } void main( ) {

int b=2 , p=0 ; c=1 ; p=func(b , a) ;

printf(\} 4,2,8,9

(5)

unsigned fun6(unsigned num) {

unsigned k=1;

do { k*=num; num/=10; } while(num); return k; }

void main( ) {

unsigned n=26;

printf(\} 12 (6)

#include int max(int a,int b); main() {

int x,y,z,t,m;

scanf(\ t=max(x,y); m=max(t,z); printf(\}

int max(int a,int b) { if(a>b) return(a); else

return(b); }

运行时若输入:10,15,9 则输出:___ 15

联系客服:779662525#qq.com(#替换为@)