Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Define an integer array with the length of 10, assign values to each element in turn through a loop, and finally calculate the odd and even numbers of the array.
Define an integer array with the length of 10, assign values to each element in turn through a loop, and finally calculate the odd and even numbers of the array.
# contains "stdio.h"

int main()

{

int x,y,I = 0;

int a[ 10]= { 0, 1,2,3,4,5,6,7,8,9 };

for(I = 0; I< 10; i++)

If (i%2! =0)

{

x++;

printf("%d ",x);

If (i%2! = 1)

{

y++;

printf("%d ",y);

}

}printf("x=%d y=%d\n ",x,y);

}