Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C language processes the given integer array A according to the following rules and generates a new integer array B. ..
C language processes the given integer array A according to the following rules and generates a new integer array B. ..
# include & ltstdio.h & gt

# Definition number 10

int main(void)

{

int a[N] = {3,6,9, 12,5,2,7, 14,3, 15},b[N]= { 0 };

int i = 0,sum = 0,j = 0,k = 0;

Floating point average = 0.0;

for(I = 0; I & ltn;; i++)

sum+= a[I];

aver = sum/ 10.0;

for(i = 0,j = 0,k = N- 1; I & ltn;; i++)

{

if(a[I]& lt; aver)

{

b[j++]= a[I];

}

other

b[k-]= a[I];

}

printf(" array b:\ n ");

for(I = 0; I & ltn;; i++)

printf("%d ",b[I]);

printf(" \ n ");

Returns 0;

}