Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <locale.h>
  4. #include <stdlib.h>
  5. #include <time.h>
  6.  
  7. //Найти в матрице первую строку, все элементы которой отрицательны.
  8. //Увеличить все элементы матрицы на значение первого элемента найденной
  9. //строки.
  10.  
  11.  
  12. int ch[10];
  13.  
  14. int main()
  15. {
  16. setlocale(LC_ALL,"Russian");
  17. int arr[5][4];
  18. int n=0,i,j;
  19.  
  20.  
  21. for(i=0;i<5;i++)
  22. {
  23. for(j=0;j<4;j++)
  24. {
  25. arr[i][j] = rand()%10;
  26. if(rand()%2)
  27. arr[i][j] = -arr[i][j];
  28. }
  29. }
  30. for(i=0;i<5;i++)
  31. {
  32. for(j=0;j<4;j++)
  33. {
  34. printf("%d ",arr[i][j]);
  35. }
  36. printf("\n");
  37. }
  38. printf("\n");
  39. for(i=0;i<5;i++)
  40. {
  41. int otric=0;
  42. for(j=0;j<4;j++)
  43. {
  44.  
  45. if (arr[i][j]<0)
  46. otric++;
  47. printf("%d,",otric);
  48. }
  49. if(otric=4)
  50. {
  51. for(j=1;j<4;j++);
  52. {
  53. arr[i][j]+=arr[i][0];
  54. }
  55. break;
  56. }
  57. }
  58.  
  59. return 0;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement