In: Computer Science
In Java: "The program should be able to read a two-digit number d from the standard input using Scanner class and outputs the second digit followed by a string literal "<-->" followed by the first digit. Run your program and make sure it prints 2<-->5 when d=52"
/********* NumberParser.java ********/
import java.util.Scanner;
public class NumberParser {
public static void main(String[] args) {
/*
* Declaring variables
*/
int number, first, second;
/*
* Creating an Scanner class object
which is used to get the inputs
* entered by the user
*/
Scanner sc = new
Scanner(System.in);
// Getting the input entered by
the user
System.out.print("Enter a two digit
number :");
number = sc.nextInt();
// Finding the first and second
digit
first = number % 10;
second = number / 10;
// Displaying the output
System.out.println(second +
"<-->" + first);
}
}
/*********************************************/
/*********************************************/
Output:
/*********************************************/