prometheus800

lab_14_prag1

Dec 8th, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int x,m,n,i=0,j=0,zbir=0;
  7.     int a[100][100];
  8.     scanf("%d",&x);
  9.     scanf("%d%d",&n,&m); //dimenzii na matrica
  10.     for(i=0;i<n;i++)     //polnjenje
  11.     {
  12.         for(j=0;j<m;j++)
  13.         {
  14.             scanf("%d",&a[i][j]);
  15.             zbir+=a[i][j];
  16.         }
  17.         if(zbir>x)
  18.         {
  19.             for(j=0;j<m;j++)
  20.                 printf("1 ");
  21.         }
  22.         else if(zbir<x)
  23.         {
  24.             for(j=0;j<m;j++)
  25.                 printf("-1 ");
  26.         }
  27.         else if(zbir==x)
  28.         {
  29.             for(j=0;j<m;j++)
  30.                 printf("0 ");
  31.         }
  32.         printf("\n");
  33.         zbir=0;
  34.     }
  35.  
  36.     return 0;
  37. }
Add Comment
Please, Sign In to add comment