Why this design does not pass the test?
Tell me what the error is.
In this task you need to write a program that will determine whether the number is a palindrome.
The algorithm is as follows: you need to write the original number back to front and compare this option with the original. If both numbers are equal, we have a palindrome.
var poly = 1221; var ylop = 0; var isPalindrome = false; var biba = 0; while (isPalindrome = false) { biba = poly % 10; ylop = Math.round(poly / 10) + biba.toString(); if (ylop == poly) { isPalindrome = true; } else { break; } }
isPalindrom = false
will always returnfalse
? - ThisManbiba
?))) funny name - ThisManнужно записать изначальное число задом наперёд и сравнить этот вариант с изначальным.
your code does something else - ThisMan1221
, divide the numbers122
and1
into two, after which they are glued together again in1221
. This is definitely not what the task requires of you. In general, fixisPalindrome == false
soisPalindrome == false
and try to solve it yourself. - Alex Krass