(C)程序运行结果题

1.


# include < stdio . h >
 void main ()
{
 int x , i ;
 for ( i =1; i <=100; i ++)
{
 X = i ;
 if (++ x %2==0)
 if (++ x %3==0)
 if (++ x %7==0)
 printf ("% d ", x );
}}

答案:28  70 

2.


# include < stdio . h >
 int main ()
{ int a [3][3]=((1,2,3),(4,6,2),(9,3,6}), s =0;
 int i , j , k =1;
 for ( i =0; i <3; i ++)
{
 for ( j =0; j <3: j ++)
 a [ il [ j ]= a [ i ][ j ]/ k ;
 k ++;
}
 for ( i =0; i <3; i ++)
 s += a [ i ] [i ];
 printf ("% d ", s );
 return 0;
}

答案:6

3.

# include < stdio . h >
 union myun 
{ struct 
{ int x , y , z ;}u ;
 int k ;
 }a ;

 void main ()
{
 a . u . x =4; a . u . y =5; a . u . z =6; a . k =0;
 printf ("% d \ n ", a . u . x );
}

答案:0

你可能感兴趣的:(c语言,算法,c++)