Commit dbf78af4 by hamasi

naidiskt

parent 5ba61ec9
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
srand(time(NULL));
int n,m,i,j,k;
int MaxN = 10;
int MaxM = 20;
int A[MaxN][MaxM];
int SummaMaatriks[3];
do
{
printf("sisesta N: ");
scanf("%d", &n);
printf("Sisesta M: ");
scanf("%d", &m);
}
while( (n < 7 || n > MaxN) || (m > MaxM || m < 0));
for(i = 0; i < n; i++)
{
for(j = 0; j < m; j++)
{
printf("Sisesta element A[%d][%d] : ", i, j);
A[i][j]=rand() % 200-100;
printf("%d\n",A[i][j]);
}
}
k = 0;
for(i = 7; i < n; i++)
{
SummaMaatriks[k] = 0;
for(j=0 ;j<m ;j++)
{
if(A[i][j]<0)
{
SummaMaatriks[k]=SummaMaatriks[k]+A[i][j];
}
}
k++;
}
i=7;
for(k=0;k<n-i;k++)
{
printf("SummaMaatriks on: %d" ,SummaMaatriks[k]);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment