Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Define an array (with graphics) with 30 plastic elements.
Define an array (with graphics) with 30 plastic elements.
//The first question

# include & ltstdio.h & gt

void main()

{

int I;

int array[30]= { 0 };

int average[6]= { 0 };

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

{

array[I]= 2 * I;

average[I/5]+= array[I];

}

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

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

}

//The second question

# include & ltstdio.h & gt

void main()

{

int i,j;

int array[2][3] = {{2,4,6},{8, 10, 12 } };

for(j = 0; j & lt3; j++)

{

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

printf("%d ",array[I][j]);

printf("\n ")

}

}

//The third question

# include & ltstdio.h & gt

void main()

{

int I;

int choices[20]= { 0 };

int total[5]= { 0 };

Printf ("Please enter an option (1-5): \ n");

for(int I = 0; I & lt20; i++)

Scanf("%d ",& choose [i]);

for(int I = 0; I & lt20; i++)

If (select [I] > = 1。 & select [I] <; = 5)

total[choices[I]- 1]++;

Printf ("The result of selection is: \ n");

for(int I = 0; I<5; i++)

Printf ("product I is %d\n", total [i]);

}