java - number reversal program gives only the first digit in output instead of the whole number -


string s1; int a, b, c = 0; s1 = t1.gettext(); = integer.parseint(s1); while (a > 0) {     b = % 10;     c = c * 0 + b;     = / 10; } t2.settext("" + c); 

here t1,t2 text fields. please let me know did go wrong because getting first digit of number enter in output , not whole number.

your incrementation of c c = c * 0 + b; want multiply 10 instead of 0: c = c * 10 + b;


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -