[JAVA] Write a program that reads a number between 1,000 and 999,999 from the user and prints it with a comma separating the thousands.
Here is a sample dialog;
Please enter an integer between 1000 and 999999: 23456
Output: 23,456

Respuesta :

Answer:

import java.util.Scanner;

public class Comma {

 public static void main(String[] args) {

  Scanner input = new Scanner(System.in);

  System.out.println("please enter an ineger between 1,000 and 999,999");

  String number = input.nextLine();

    System.out.println(number.replace(",", ""));

 

 

 

 }

}

Explanation:

here is the solution