+ 17

[CHALLENGE] Flipping numbers

Flipping numbers flip your number backwards. For example: Input: 1836 Output: 6381 Input: 15788 Output: 88751 Write the program that flips the entered number. My version https://code.sololearn.com/cXig2it0O4WJ/?ref=app

25th Apr 2018, 7:57 PM
Shimon
Shimon - avatar
19 Respostas
+ 18
https://code.sololearn.com/cAlwT7YkyqQt/?ref=app https://code.sololearn.com/cfLCd2I3wGJY/?ref=app The second one is Oneliner
26th Apr 2018, 7:44 PM
Baraa AB
Baraa AB - avatar
+ 24
public class FlippingNumber{ public static void main(String args[]){ int a=3564; String b=Integer.toString(a); StringBuffer obj=new StringBuffer(b); obj.reverse(); String c=obj.toString(); int d=Integer.parseInt(c); System.out.println(d);
20th Jul 2018, 12:57 PM
Sumit ProgrammeršŸ˜ŽšŸ˜Ž
Sumit ProgrammeršŸ˜ŽšŸ˜Ž - avatar
17th Jun 2018, 6:41 PM
Hans Larry Mba Bekale
Hans Larry Mba Bekale - avatar
+ 16
Simon Nikiforov Thanks a lot bro šŸ’™šŸ˜‰ Glad to like my comment and my code šŸ’ššŸ’•
27th Apr 2018, 10:29 AM
Baraa AB
Baraa AB - avatar
26th Apr 2018, 9:40 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 12
one-liner in js console.log(prompt("Please enter a number.").toString().split("").reverse().join(""));
28th Apr 2018, 3:45 AM
Vikash Pal
Vikash Pal - avatar
+ 10
p gets.chomp.reverse.to_i ĀÆ\_(惄)_/ĀÆ
25th Apr 2018, 8:37 PM
Mickel
Mickel - avatar
+ 9
https://code.sololearn.com/c8CGjgKVAAN9/?ref=app
28th Apr 2018, 3:46 AM
Vikash Pal
Vikash Pal - avatar
+ 7
Solutions in C++: 1) int n; cin>>n; while (n) { cout<<n % 10; n /= 10 } 2) string s; cin>>s; for (int i = s.length() - 1; i >= 0; iā€”) cout<<s[i];
25th Apr 2018, 8:10 PM
Ali Zhussupov
Ali Zhussupov - avatar
+ 7
number=1234 number+=""; number=number.split("").reverse().join(""); number=parseInt(number) alert(number) //4321
25th Apr 2018, 8:17 PM
į Œį ŒCode X
į Œį ŒCode X - avatar
+ 6
To flip a number - not a string as others do : https://code.sololearn.com/cUZMG2p7jSR9/?ref=app
25th Apr 2018, 9:44 PM
VcC
VcC - avatar
+ 6
int reverse(int num) { int remainder = 0, rev = 0; while (num != 0) { remainder = num % 10; rev = rev * 10 + remainder; num = num / 10; } return rev; }
26th Apr 2018, 2:15 AM
Ayush Bious Raj
Ayush Bious Raj - avatar
26th Apr 2018, 8:05 PM
Š ŠµŃ‚Ń€0
+ 4
https://code.sololearn.com/cXai64JhU2fR/?ref=app
22nd Jul 2018, 2:06 PM
Seniru
Seniru - avatar
+ 2
https://code.sololearn.com/cTG58Hdqid3f/#py
27th Apr 2018, 6:54 PM
Tiago Henrique R Moreno
Tiago Henrique R Moreno - avatar