+ 46
🏆🏆challenge [remove zero]🏆🏆
Write a program to remove zero from a given integer. any language is welcome example :- input = 100704300 output =1743
149 Answers
+ 45
JavaScript:
alert(prompt("").split("0").join(""));
+ 40
print("".join(i for i in input() if int(i)))
https://code.sololearn.com/cOH87hH99YD9/?ref=app
+ 38
piece of cake ruby wins!!!
https://code.sololearn.com/cqJg0qW871kq/?ref=app
+ 22
Or, translating Krishna's JS into Python 😁:
print("".join(input().split("0")))
+ 22
alert(prompt('').replace(/[0]/g, ''))
+ 20
Just because I wanna stand out:
print("".join(list(filter(lambda x:x!="0",list(str(int(input())))))))
#lmao so many
+ 15
One line Python. Also checks for valid input
https://code.sololearn.com/cK4q2NnwfqJJ/?ref=app
+ 15
https://code.sololearn.com/c7hY7OFjaqzu/?ref=app
+ 14
my java version 😃
https://code.sololearn.com/c5KqA7CV23ni/?ref=app
+ 13
Probably the shortest one in java.
https://code.sololearn.com/cNW2TfitqgeI/?ref=app
+ 12
https://code.sololearn.com/cuk4fQ1e738C/?ref=app
+ 12
i tried to make it as short as python codes 😂😂
https://code.sololearn.com/cdm0y008Ug9y/?ref=app
+ 11
Number.prototype.removeZeroes = function() {
return (''+this).split("0").join('')
}
var num = 100704300;
console.log(num.removeZeroes());
+ 11
My try on cpp 😁
https://code.sololearn.com/cWcfFqaDNqEU/?ref=app
+ 10
<?php
$num =100704300;
$num2 = explode(0, $num);
$result = implode($num2, '');
echo $result;
?>
+ 10
My Java code works just fine for the task-
https://code.sololearn.com/cxdJeXOpVHtd/?ref=app
+ 9
+ 9
# removes zeros from input number
print("".join(i for i in input() if int(i)))
# or even shorter, adapting Krishna's JS code:
# print("".join(input().split("0")))