Write a java program that can convert a string of numbers (e.g. "5387") into an integer (5387).
Anonymous
why do you need Math.pow()? will this work? fun() // input 5467 // take first character and transform into integer //multiply by 10 * index of character which is zero that is 5 + 0 = 5 then take the next character and transform into integer now multiply 5 * 10 * index of character which is one 50 +4 = 54 repeat 540+ 6 = 546 5460 + 7 = 5467 running time is O(k) k = no of digits or O(n) n being the number
Check out your Company Bowl for anonymous work chats.