Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define MAX 100
- int main ()
- {
- int matrica[100][100];
- int i,j;
- int redica,kolona;
- int count2=0,count4=0;
- scanf("%d %d",&redica,&kolona);
- for(i=0;i<redica;i++)
- for(j=0;j<kolona;j++)
- scanf("%d",&matrica[i][j]);
- // Vcituvanje na matricata // KRAJ //
- // Pocetok na prvrtuvanje na matricata
- for (i=0;i<redica;i++)
- {
- int count=0;
- for(j=0;j<kolona;j++)
- {
- if(matrica[i][j]==1)
- {
- count++;
- }
- else
- {
- if(count>=3)
- {
- count2++;
- break;
- }
- count=0;
- }
- }
- }
- // KOLONIII ! KRAJ !
- for (j=0;j<kolona;j++)
- {
- int count3=0;
- for(i=0;i<redica;i++)
- {
- if(matrica[i][j]==1)
- {
- count3++;
- }
- else
- {
- if(count3>=3)
- {
- count4++;
- break;
- }
- count3=0;
- }
- }
- }
- printf("%d",count2+count4);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement