Program:-
import java.util.Scanner;
public class p5b {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int n;
System.out.println("enter the number:");
n=s.nextInt();
int r=0;
while(n!=0)
{
r=r*10;
r=r+n%10;
n=n/10;
}
System.out.println("revers number is:"+r);
}
}
Output:-
No comments:
Post a Comment