Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <clocale>
- #include <cstdlib>
- #define ROWS 4
- #define COLS 3
- using namespace std;
- void main() {
- setlocale(LC_ALL, "Russian");
- int B[ROWS][COLS], A[ROWS] = { 0, 0, 0, 0 };
- printf("\nArray B: \n");
- for (int i = 0; i < ROWS; i++) {
- for (int j = 0; j < COLS; j++) {
- B[i][j] = rand() % 100 - 50;
- printf("%d\t", B[i][j]);
- if (B[i][j] > 0) {
- A[i] += B[i][j];
- }
- }
- printf("\n");
- }
- printf("\nArray A\n");
- for (int i = 0; i < ROWS; i++) {
- printf("%d\t", A[i]);
- }
- _getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement