Created
December 4, 2014 14:17
-
-
Save savaryna/24a8b5d27c956b59236d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <conio.h> | |
#include <stdio.h> | |
// Calculeaza produsul elementelor diagonalei secundare ale unei matrici | |
void main(){ | |
int a[20][20], i, j, n, p; | |
printf("Dati numarul de linii si coloane a matricei: "); | |
scanf("%d", &n); | |
for(i=1; i<=n; i++) | |
for(j=1; j<=n; j++){ | |
printf("a[%d,%d]=", i, j); | |
scanf("%d", &a[i][j]); | |
} | |
p=1; | |
for(i=1; i<=n; i++) | |
for(j=1; j<=n; j++) | |
if(i+j == n+1){ | |
p*=a[i][j]; | |
} | |
printf("Produsul elementelor diagonalei secundare este: %d", p); | |
printf("\n"); | |
getch (); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment