Answers for "java program to print commas in integer"

0

output with comma java

public class Primes {

 public static void main(String[] args) {

    StringJoiner joiner = new StringJoiner(",");

    Scanner sc = new Scanner(System.in);
    int start = sc.nextInt();
    int end = sc.nextInt();

    for (int i =start; i <= end; i++) {

        if (isPrime(i)) {
            joiner.add(Integer.toString(i));
        }

    }

    System.out.println(joiner.toString());
}
Posted by: Guest on June-17-2021

Code answers related to "java program to print commas in integer"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language