+ 5
Challenge time! : Add 1 to each digit of a number
Write a code which inputs a number from the user and outputs a number which has each digit incremented by 1 Example : 239 Output : 350 (since 9+1=10 with 1 carry) 123-->234 Happy coding! Answers in C++, Java will be prefered though all languages r welcome!
9 Réponses
+ 5
heres mine...
with STEP-details ##
( input a number )
https://code.sololearn.com/ccFzmlmE48c5/?ref=app
+ 21
https://code.sololearn.com/coN4Atqn87kz/?ref=app
+ 10
here's my code...🐍
https://code.sololearn.com/c8yhJZtFR66B/?ref=app
+ 8
..and mine in C++
https://code.sololearn.com/cahdn69ANcmG/?ref=app
+ 7
and my code in Java...
https://code.sololearn.com/cDEQjnJXybi7/?ref=app
+ 4
@sayan Nice code! I really appreciate ur effort!
+ 2
n+sum([10**i*(-9 if ((n//10**i)%10)==9) else 1) for i in range(log10(n))])
+ 2
☺✌thanks number/0
+ 2
with carry this is really simple
from math import log10
chgc=lambda n:n+(10**int(log10(n)+1)-1)//9
print(chgc(int(input())))
https://code.sololearn.com/c95wsH0nhFZ4/?ref=app