Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include <locale.h>
- #include <stdlib.h>
- #include <time.h>
- //Найти в матрице первую строку, все элементы которой отрицательны.
- //Увеличить все элементы матрицы на значение первого элемента найденной
- //строки.
- int ch[10];
- int main()
- {
- setlocale(LC_ALL,"Russian");
- int arr[5][4];
- int n=0,i,j;
- for(i=0;i<5;i++)
- {
- for(j=0;j<4;j++)
- {
- arr[i][j] = rand()%10;
- if(rand()%2)
- arr[i][j] = -arr[i][j];
- }
- }
- for(i=0;i<5;i++)
- {
- for(j=0;j<4;j++)
- {
- printf("%d ",arr[i][j]);
- }
- printf("\n");
- }
- printf("\n");
- for(i=0;i<5;i++)
- {
- int otric=0;
- for(j=0;j<4;j++)
- {
- if (arr[i][j]<0)
- otric++;
- printf("%d,",otric);
- }
- if(otric=4)
- {
- for(j=1;j<4;j++);
- {
- arr[i][j]+=arr[i][0];
- }
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement