Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Input a plastic two-dimensional array with 4 rows and 5 columns from the keyboard, and find out the array elements equal to the given value X through programming. If successful, output the line number
Input a plastic two-dimensional array with 4 rows and 5 columns from the keyboard, and find out the array elements equal to the given value X through programming. If successful, output the line number
Input a plastic two-dimensional array with 4 rows and 5 columns from the keyboard, and find out the array elements equal to the given value X through programming. If successful, output the line number and column number. # contains "stdio.h"

int main(int argc,char *argv[]){

int a[4][5],I,j,x;

Printf ("Please specify an initial value ... \ n");

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

for(j = 0; j & lt5; scanf("%d ",a[I]+j++);

Printf ("Please enter a number to find x ... \ nx =");

scanf("%d ",& ampx);

for(I = 0; I<4; i++){

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

if(x==a[i][j]){

Printf("%d is located in [%d][%d]. \n”,x,I,j);

Break;

}

if(j & lt; 5)

Break;

}

If (i>3)

Printf ("Find fault ... \ n");

Returns 0;

}

Code format and running sample picture: