Untitled
unknown
plain_text
2 years ago
887 B
3
Indexable
#include <iostream> using namespace std; int main() { int n,produs = 1; cout << "Introduceti dimensiunea tabloului patrat: "; cin >> n; int tablou[n][n]; cout << "Introduceti elementele tabloului patrat:" << endl; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { cin >> tablou[i][j]; } } for(int i = 1; i < n; i += 2) { for(int j = 0; j < n; j++) { if(tablou[i][j] < 0 && tablou[i][j] % 2 == 0) { produs *= tablou[i][j]; } } } cout << "Produsul elementelor pare negative din toate randurile pare este: " << produs << endl; cout << "Tabelul este" << endl; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { cout << tablou[i][j]; } cout << endl; } return 0; }
Editor is loading...