Работы по программированию

This commit is contained in:
IgorVolochay
2026-07-28 09:56:54 +03:00
parent b85155ff95
commit 8602b7e845
73 changed files with 4090 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
/*
7.Создать целочисленный массив A[5][5]. При помощи цикла и оператора условия задать его значения, как показано ниже:
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
5 5 5 5 5
*/
#include <stdio.h>
#define N 5
void setArray(int (*array)[N]) {
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
array[i][j] = i+1;
}
}
}
void printArray(int (*array)[N] ) {
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
printf("%2d", array[i][j]);
}
puts("");
}
}
int main() {
int A[N][N];
setArray(A);
printArray(A);
return 0;
}