by CodeChum Admin
After getting out of the strange dimension, you feel like you have to cover up your path and close the exit so that nothing strange can follow you back.
Instructions
Input
Two ints separated by a space
0·0
Output
5x5 array with each sub array in a new line and each element separated by a space
0·1·1·1·1
1·1·1·1·1
1·1·1·1·1
1·1·1·1·1
1·1·1·1·1
-----------fill up the code---------------
#include<stdio.h>
int main() {
int exitRow,exitCol;
scanf("%d %d", &exitRow,&exitCol);
int row_col[5][5] = {{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1},{1,1,1,1,1}};
return 0;
}
#include <stdio.h>
int main()
{
int exitRow, exitCol;
scanf("%d %d", &exitRow, &exitCol);
int row_col[5][5] = {
{ 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1 }
{ 1, 1, 1, 1, 1 }
}
if (exitRow < 5 && exitCol < 5) {
row_col[exitRow][exitCol] = 0;
}
for (int i = 0; i < 5; i = i + 1) {
for (int j = 0; j < 5; j = j + 1) {
printf("%d ", row_col[i][j]);
} printf("\n");
}
return 0;
}
Comments
Leave a comment