/
merdan
/
controlWorks_tests
Обзор
Документация
Войти
/
merdan
/
controlWorks_tests
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Methods/IsPalindrome.cs
32 строки
613 B
merdan
I wrote the tests
15 ноя 2025, 04:36
15 ноя 2025, 04:36
7047a79
Код
Авторство
О чём код?
namespace Methods; public class IsPalindrome { public static bool Answer(int? x) { if (x == null) { throw new ArgumentNullException( nameof(x), " The number cannot be null!"); } if (x < 0) { return false; } string num = x.ToString(); int count = 0; for(int i=0; i<num.Length;i++) { if(num[i] == num[num.Length-(i+1)]) { count++; } } if ((num.Length)==count) return true; return false; } }