F&A Diskussionen
% (помогите разобраться)
0 Stimmen
1 AntwortAddition of two numbers
-5 Stimmen
9 AntwortenSum of amicable numbers
1 Stimme
1 AntwortCan someone explain this code to me....
class ReverseNumberDemo
{ public static void main(String args[]) {
int num=123456789;
int reversenum =0;
while( num != 0 ) {
reversenum = reversenum * 10;
reversenum = reversenum + num%10;
num = num/10; }
System.out.println("Reverse of specified number is: "+reversenum);
}
}
the thing I don't get is the reversenum part......isn't reversenum=0 so wouldn't reversenum*10=0
0 Stimmen
8 Antwortenwhat is wrong with this code ?
6 Stimmen
4 Antworten