Reverse of number
import java.util.*;
class reverseofnumber{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number");
int k= sc.nextInt();
int rev=0;
while(k!=0){
int n=k%10;
rev= rev*10 +n;
k=k/10;
}
System.out.println("Reverse of number is "+rev);
}
}
Comments
Post a Comment