DEV Community

hema latha
hema latha

Posted on • Edited on

while loop programs Reverse No

package day1;

public class Reverse {

public static void main(String[] args) {
    // TODO Auto-generated method stub
    int no = 5678;

    int reverse = 0;
    while(no>0)
    {
        reverse = no%10;
                 system.out.print(reverse);
        no=no/10;


    }
     }}
Enter fullscreen mode Exit fullscreen mode

output= 8765

Top comments (0)