+ 46

🏆🏆challenge [remove zero]🏆🏆

Write a program to remove zero from a given integer. any language is welcome example :- input = 100704300 output =1743

10th Oct 2017, 5:26 AM
Abhishek Pun
Abhishek Pun - avatar
149 Answers
+ 45
JavaScript: alert(prompt("").split("0").join(""));
10th Oct 2017, 12:07 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 40
print("".join(i for i in input() if int(i))) https://code.sololearn.com/cOH87hH99YD9/?ref=app
10th Oct 2017, 7:07 AM
David Ashton
David Ashton - avatar
10th Oct 2017, 5:33 AM
Lord Krishna
Lord Krishna - avatar
+ 22
Or, translating Krishna's JS into Python 😁: print("".join(input().split("0")))
10th Oct 2017, 12:17 PM
David Ashton
David Ashton - avatar
+ 22
alert(prompt('').replace(/[0]/g, ''))
11th Oct 2017, 5:04 AM
Maz
Maz - avatar
+ 20
Just because I wanna stand out: print("".join(list(filter(lambda x:x!="0",list(str(int(input()))))))) #lmao so many
10th Oct 2017, 8:39 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 15
One line Python. Also checks for valid input https://code.sololearn.com/cK4q2NnwfqJJ/?ref=app
10th Oct 2017, 6:59 AM
Vari93
Vari93 - avatar
+ 15
https://code.sololearn.com/c7hY7OFjaqzu/?ref=app
10th Oct 2017, 12:21 PM
SAKSHI
SAKSHI - avatar
12th Oct 2017, 6:33 PM
Vukan
Vukan - avatar
+ 13
Probably the shortest one in java. https://code.sololearn.com/cNW2TfitqgeI/?ref=app
11th Oct 2017, 12:10 AM
qwerty
qwerty - avatar
+ 12
https://code.sololearn.com/cuk4fQ1e738C/?ref=app
10th Oct 2017, 7:16 AM
Emma
10th Oct 2017, 3:53 PM
Ekansh
+ 12
i tried to make it as short as python codes 😂😂 https://code.sololearn.com/cdm0y008Ug9y/?ref=app
12th Oct 2017, 5:48 AM
Germain F
Germain F - avatar
+ 11
Number.prototype.removeZeroes = function() { return (''+this).split("0").join('') } var num = 100704300; console.log(num.removeZeroes());
10th Oct 2017, 5:35 AM
Calviղ
Calviղ - avatar
10th Oct 2017, 9:23 PM
Леон Алексанянц
Леон Алексанянц - avatar
14th Oct 2017, 11:42 AM
David Akhihiero
David Akhihiero - avatar
+ 10
<?php $num =100704300; $num2 = explode(0, $num); $result = implode($num2, ''); echo $result; ?>
12th Oct 2017, 4:31 AM
Rain
Rain - avatar
+ 10
My Java code works just fine for the task- https://code.sololearn.com/cxdJeXOpVHtd/?ref=app
12th Oct 2017, 6:11 AM
Vedansh Agrawal
Vedansh Agrawal - avatar
10th Oct 2017, 4:32 PM
Ferhat Sevim
Ferhat Sevim - avatar
+ 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")))
11th Oct 2017, 12:38 AM
Ravish kumar singh
Ravish kumar singh - avatar