+ 5

Plz help me to find out the error in this program ( Java ) . Its very urgent. On running it , "Memory Limit exceeeded " is shown

Find the no. x such that if you take the digit in the one's place and place it in front , the new digit formed is 4 times the original number https://code.sololearn.com/cwL0QlEVgI8z/?ref=app https://code.sololearn.com/cwL0QlEVgI8z/?ref=app

14th May 2018, 3:14 PM
KuSuMiTa
KuSuMiTa - avatar
12 Respostas
+ 5
https://code.sololearn.com/cwrk1Cw4xxM0/?ref=app it work fine in my pc but i say infinite loop is not good.. so you change according to your desire input. your error in loop and if statement Pls check and let me if there is any bug
14th May 2018, 4:26 PM
Arun Tomar
Arun Tomar - avatar
+ 3
Its okk Donna ... :)
14th May 2018, 4:07 PM
KuSuMiTa
KuSuMiTa - avatar
+ 2
Donna in front of the no. itself .. Lyk for ex. in 230769 , if 9 is taken out n put in front , then the new no. is 923076 . And , 923076 = 230769 × 4 .
14th May 2018, 3:56 PM
KuSuMiTa
KuSuMiTa - avatar
+ 2
Dario but i need the largest such possible no.
14th May 2018, 3:59 PM
KuSuMiTa
KuSuMiTa - avatar
+ 1
Donna 230769 is an example
14th May 2018, 3:47 PM
KuSuMiTa
KuSuMiTa - avatar
+ 1
the for loop is a infinite one in fact for(long=1; i<=0; i++) never ends. Try with: for(long i=0; i<=1000; i++) or something like this.
14th May 2018, 3:58 PM
Dario
Dario - avatar
+ 1
In CP it works only with i<=70000, you could try in your computer....
14th May 2018, 4:07 PM
Dario
Dario - avatar