Results 1 to 3 of 3
Thread: .
Hybrid View
-
14th May 2010 19:13 #1
.
, . , . :
, N, N x N , .
Code:#include <stdio.h> int main () { int N, i, j, som_a, som_b, som_c, som_max; printf("Vuvedete realno 4ieslo, opredelq6to razmera na matrica: "); 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]); } } som_a = 0; som_b = 0; som_c = 0; som_max=0; for (i = 0; i < N; i++) { for (j = 0; j< N; j++) { if (i==j) som_a+=a[i][j]; if (i==j+1)som_b+=a[i][j]; if (i==j-1)som_c+=a[i][j]; } if (som_a < som_b) som_a = som_b; if(som_b < som_c) som_b = som_c; if(som_max < som_a) som_max = som_a; } printf("Maksimalnata suma e ravna na %d \n", som_max); return 0; }
- :
. sum_a/b/c , sum_max .Code:if (som_a < som_b) som_a = som_b; if(som_b < som_c) som_b = som_c; if(som_max < som_a) som_max = som_a;
:
33 . - , 55 ?Code:if (i==j) som_a+=a[i][j]; if (i==j+1)som_b+=a[i][j]; if (i==j-1)som_c+=a[i][j];
-
14th May 2010 22:44 #2Registered User
Join Date: Dec:2007
Location: Sofia
Posts: 366
- JanBird,

, ( ). , - " , " - .
-
15th May 2010 11:39 #3
. . . <_< , .
Last edited by froid; 15th May 2010 at 17:58.




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