Commit d9b89a05 by anljam

Add new file

parents
Showing with 62 additions and 0 deletions
#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("SummaV22rtus : %d \n", SummaMaatriks [k]);
}
return 0;
}
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