Skip to content

добавила решение контрольной работы Иванова Алина#7

Open
ialina07 wants to merge 1 commit intomainfrom
kr
Open

добавила решение контрольной работы Иванова Алина#7
ialina07 wants to merge 1 commit intomainfrom
kr

Conversation

@ialina07
Copy link
Owner

No description provided.

@ialina07 ialina07 requested a review from chernishev October 17, 2025 14:26
Copy link
Collaborator

@p-senichenkov p-senichenkov left a comment

Choose a reason for hiding this comment

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

Палиндром: 10/10
Сумма цифр: 5/10

// Работаем с абсолютным значением числа
int n = a < 0 ? -a : a;

// Преобразуем число в строку
Copy link
Collaborator

Choose a reason for hiding this comment

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

Не самый эффективный подход, хоть и довольно естественный.

Comment on lines +45 to +46
// Работаем с абсолютным значением числа
int n = a < 0 ? -a : a;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Для этого в стандартной библиотеке есть функция abs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ваша программа выдаёт неправильный ответ, например, на массиве 47 14 56 20. Прочитайте внимательно задание.

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.

2 participants