Results 1 to 3 of 3
Hybrid View
-
6th May 2010 16:03 #1
, N, N x N , .
:
#include <stdio.h>
#define MAXCOL 10
#define MAXROW 10
void main (void); {
int N, i, j;
printf(Vuvedete realno 4islo opredelq6to razmara na amtrica") ;
scanf(%d, &N);
int a [MAXROW][MAXCOL];
for (i=0; i<N; i++) {
for (j=0; j<N; j++) {
, .
-
6th May 2010 17:47 #2
-
6th May 2010 17:52 #3Registered User
Join Date: Feb:2006
Location: Plovdiv
Posts: 392
a[n][n]
Code:#include <stdio.h> #include <limits.h> int main(void) { int n, i, j, sum_a, sum_b, max_sum = INT_MIN; printf("Vuvedete realno 4islo opredelq6to razmara na amtrica: "); scanf("%d", &n); int a[n][n]; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { printf("Vuvedete[%d][%d]: ", i, j); scanf("%d", &a[i][j]); } } for (i = 1; i < n; i++) { sum_a = 0; sum_b = 0; for (j = 0; j + i < n; j++) { sum_a += a[i + j][j]; sum_b += a[j][i + j]; } if (sum_a < sum_b) sum_a = sum_b; if (max_sum < sum_a) max_sum = sum_a; } printf("max sum: %d \n", max_sum); return 0; }






Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in