Skip to content

Conversation

@SL-TX
Copy link
Owner

@SL-TX SL-TX commented Aug 20, 2022

1.6. Массивы ч.2


// Задание 1
int sum=0;
for (int i : arr) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

здесь лучше назвать переменную более осознанно, т.к. обычно i называют индексы массива, а здесь уже не индекс, а элемент

// Задание 2
int min = 0,max=0;
for (int i : arr) {
if (min ==0 || min > i)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

фигурные скобки надо ставить

for (int i : arr) {
if (min ==0 || min > i)
min = i;
if (max ==0 || max < i)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

фигурные скобки надо ставить

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants