Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Ad icon
V2ray VPN for Tunneling
hu KANNA
Updated:
Oct 22, 2026
FREE SEO Check & Google Maps Check for Sri Lankan Businesses | Web Design, Website Price Rs 14,900 |
LankaSolve
Updated:
Oct 20, 2026
ඕනම රටකට සෙට් වෙන CV එකක්
ErMurazor
Updated:
Oct 17, 2026
Hambantota
7 Acres Beachfront Land For Sell DownSouth , PerPerch Price 420 000
1024 Digital
Updated:
Oct 14, 2026
Baseus PI LITE INDOOR CAMERA
ErMurazor
Updated:
Oct 12, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
Java Problem
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="chinthakapathir" data-source="post: 9867801" data-attributes="member: 39276"><p>[CODE]import java.util.*;</p><p></p><p>/**</p><p> *</p><p> * @author Chinthy</p><p> */</p><p>public class Base</p><p>{</p><p></p><p></p><p> public static void main(String args[])</p><p> {</p><p> int number;</p><p> double val = 0;</p><p> int length;</p><p> int base;</p><p></p><p> System.out.println("Enter value: ");</p><p> Scanner scan1 = new Scanner(System.in);</p><p> number = scan1.nextInt();</p><p> length = String.valueOf(number).trim().length();</p><p></p><p> System.out.println("Enter base value: ");</p><p> Scanner scan2 = new Scanner(System.in);</p><p> base = scan2.nextInt();</p><p></p><p> while(number>0)</p><p> {</p><p> double [] rem = new double[length];</p><p> for(int i =0;i<length;i++)</p><p> {</p><p> </p><p> rem[i] = number % 10;</p><p> number = number / 10;</p><p></p><p> val = val + (rem[i]*(Math.pow(base, i)));</p><p> }</p><p></p><p> }</p><p></p><p> System.out.println("Value: "+val);</p><p></p><p></p><p></p><p></p><p></p><p> }</p><p></p><p></p><p></p><p>}</p><p>[/CODE]</p><p></p><p><span style="font-size: 12px"><span style="color: Blue">Checked two three values. Harida danne na dan haduwe... i think this should work.</span></span><img src="/styles/default/xenforo/smilies/default/D.gif" class="smilie" loading="lazy" alt=":D" title="Big grin :D" data-shortname=":D" /><img src="/styles/default/xenforo/smilies/default/D.gif" class="smilie" loading="lazy" alt=":D" title="Big grin :D" data-shortname=":D" /><img src="/styles/default/xenforo/smilies/default/D.gif" class="smilie" loading="lazy" alt=":D" title="Big grin :D" data-shortname=":D" /></p></blockquote><p></p>
[QUOTE="chinthakapathir, post: 9867801, member: 39276"] [CODE]import java.util.*; /** * * @author Chinthy */ public class Base { public static void main(String args[]) { int number; double val = 0; int length; int base; System.out.println("Enter value: "); Scanner scan1 = new Scanner(System.in); number = scan1.nextInt(); length = String.valueOf(number).trim().length(); System.out.println("Enter base value: "); Scanner scan2 = new Scanner(System.in); base = scan2.nextInt(); while(number>0) { double [] rem = new double[length]; for(int i =0;i<length;i++) { rem[i] = number % 10; number = number / 10; val = val + (rem[i]*(Math.pow(base, i))); } } System.out.println("Value: "+val); } } [/CODE] [SIZE="3"][COLOR="Blue"]Checked two three values. Harida danne na dan haduwe... i think this should work.[/COLOR][/SIZE]:D:D:D [/QUOTE]
Insert quotes…
Verification
Hath warak paha keeyada? (hatha wadikireema paha)
Post reply
Top
Bottom