File in,txt in the default package has the following format

Страницы работы

Содержание работы

Variant 1

File in.txt in the default package has the following format:

natural value of n

string 1, containing n real numbers, separated by any quantity of spaces

string n, containing n real numbers, separated by any quantity of spaces

1)  Load the data from the file in.txt into the matrix a[n][n].

2)  Create array b[n],where element b[i] is the sum of the minimum element of the row i and positive elements of the column i of the matrix a.

3)  Print the initial matrix a(row per line) and the array bto the console.

4)  Minimize the number of cycles in your solution.

The example of the file in.txt:

3

1.5   3  -2.0

3.4    0    10.2

2.34  -1.357   0.57

Variant 2

File in.txt in the default package has the following format:

natural value n

string, containing n real numbers, separated by any quantity of spaces

1)  Load the data from the file in.txt into the array a[n].

2)  Create array b,where element b[0] is the sum of negative elements of the array a, b[1] is the difference between maximum and minimum of the array a, b[2] is the number of zero elements of the array a.

3)  Print arrays aand bto the console.

The example of the file in.txt:

6

1.5   3  -2.0  0   -1.5 0

Похожие материалы

Информация о работе