Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <clocale>
- #include <math.h>
- #include <iomanip>
- using namespace std;
- const int n = 6, m = 7;
- int f(int x[n][m]){
- int pol = 0, otr = 0;
- for (int i = n/2; i < n; i++){
- for (int j = 0; j < m; j++){
- if (x[i][j] < 0){
- otr++;
- }
- if (x[i][j] > 0){
- pol++;
- }
- }
- }
- cout << '\n' << "Кол-во отрицательных = " << otr;
- cout << '\n' << "Кол-во положительных = " << pol;
- cout << '\n';
- return 0;
- }
- int main(){
- int a[n][m];
- for (int i = 0; i < n; i++){
- cout << '\n';
- for (int j = 0; j < m; j++){
- a[i][j] = rand()%100 - 50;
- cout << setw(4) << a[i][j];
- }
- }
- cout << '\n' << f(a);
- }
Add Comment
Please, Sign In to add comment