F
F
Forumshik2017-03-27 16:08:18
Java
Forumshik, 2017-03-27 16:08:18

Write a program to display on the screen in one line three any numbers with two spaces between them?

Scanner myScanner = new Scanner(System.in);
int x = myScanner.nextInt();
int y = myScanner.nextInt();
int z = myScanner.nextInt();
Sout(x + " " + y + " " + z);/* can the code be written differently?*/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Hland, 2017-03-27
@Forumshik

You can use String.format for example
String.format("%d %d %d", x, y, z)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question