Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define MAX_SIZE_ROW 100
- #define MAX_SIZE_COLUMN MAX_SIZE_ROW * 4
- void input(int matrix[][MAX_SIZE_COLUMN], int rowCount, int columntCount) {
- printf("Input matrix elements\n");
- for (int i = 0; i < rowCount; i++) {
- for (int j = 0; j < columntCount; j++) {
- printf("Element [%d][%d]:", i, j);
- scanf("%d", &matrix[i][j]);
- printf("\n");
- }
- printf("\n");
- }
- }
- void printMatrix(int matrix[][MAX_SIZE_COLUMN], int rowCount, int columntCount) {
- for (int i = 0; i < rowCount; i++) {
- for (int j = 0; j < columntCount; j++) {
- printf("[%d][%d]=%d ", i, j, matrix[i][j]);
- }
- printf("\n");
- }
- }
- int main()
- {
- int matrix[MAX_SIZE_ROW][MAX_SIZE_COLUMN];
- int rowCount;
- int columnCount;
- printf("Enter number of rows\n");
- scanf("%d", &rowCount);
- columnCount = rowCount * 4;
- printf("Number of rows: %d, number of columns: %d\n", rowCount, columnCount);
- //Task 3 - Input data
- input(matrix, rowCount, columnCount);
- //Task 4 - Print the input data
- printMatrix(matrix, rowCount, columnCount);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement