Tuesday, October 4, 2011

Displaying the reverse of a number (Java)

//This Java program accepts a number from the
//user and the prints the reverse of the
//Sample Input : 591
//Sample Output : 195
import java.util.*;
class reverseOfNumber
public static void main()
    System.out.println("Enter a number");
    Scanner sc=new Scanner(System.in);
    int num_orig=sc.nextInt();
    int num_new=0,n=num_orig;
    System.out.println("The reversed number is "+num_new);
//Author : Mayank Rajoria

No comments:

Post a Comment