三、 阅读下列程序,写出执行结果1.#include < stdio.h>void main( ){ int a = 5,b = 10 ,c=3 ,d=0 ;b++;c+=6;d = a < b a :b;printf ( "a=%d\n" ,a );printf ( "b=%d\n" ,b );printf ( "c=%d\n" ,c );printf ( "d=%d\n" ,d );}2.#includevoid main( ){ in
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/09 02:45:36
三、 阅读下列程序,写出执行结果1.#include < stdio.h>void main( ){ int a = 5,b = 10 ,c=3 ,d=0 ;b++;c+=6;d = a < b a :b;printf ( "a=%d\n" ,a );printf ( "b=%d\n" ,b );printf ( "c=%d\n" ,c );printf ( "d=%d\n" ,d );}2.#includevoid main( ){ in
三、 阅读下列程序,写出执行结果
1.
#include < stdio.h>
void main( )
{ int a = 5,b = 10 ,c=3 ,d=0 ;
b++;
c+=6;
d = a < b a :b;
printf ( "a=%d\n" ,a );
printf ( "b=%d\n" ,b );
printf ( "c=%d\n" ,c );
printf ( "d=%d\n" ,d );
}
2.
#include
void main( )
{ int a[8]={36,25,20,43,12,70,66,35};
int s0 ,s1 ,s2 ,i;
s0=s1=s2=0;
for( i=0 ; i < 8 ; i++){
switch (a[i]%3)
{ case 0:s0+=a[i] ; break;
case 1:s1+=a[i] ; break;
case 2:s2+=a[i] ; break;
}
}
printf ( "s0=%d\n",s0 );
printf ( "s1=%d\n",s1 );
printf ( "s2=%d\n",s2 );
}
3.
#include
void fun(int ,int ,int );
void main( )
{ int x=2 ,y=3 ,z=0;
printf ( "x=%d,y=%d,z=%d\n" ,x ,y ,z);
fun(x ,y ,z);
printf ( "x=%d,y=%d,z=%d\n" ,x ,y ,z);
}
void fun ( int a ,int b ,int c)
{ c=a+b ; a=a*a ; b=b*b;
printf ( "a=%d,b=%d,c=%d\n" ,a ,b ,c); }
三、 阅读下列程序,写出执行结果1.#include < stdio.h>void main( ){ int a = 5,b = 10 ,c=3 ,d=0 ;b++;c+=6;d = a < b a :b;printf ( "a=%d\n" ,a );printf ( "b=%d\n" ,b );printf ( "c=%d\n" ,c );printf ( "d=%d\n" ,d );}2.#includevoid main( ){ in
1. a=5
b=11
c=9
d=5
2. s0=114
s1=138
s2=55
3. x=2,y=3,z=0
a=4,b=9,c=5
x=2,y=3,z=0