- Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathjava-output-formatting.java
More file actions
Latest commit
25 lines (21 loc) · 699 Bytes
/
Copy pathjava-output-formatting.java
File metadata and controls
25 lines (21 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Java > Introduction > Java Output Formatting
// Format a string using printf.
//
// https://www.hackerrank.com/challenges/java-output-formatting/problem
// challenge id: 9472
//
importjava.util.Scanner;
publicclassSolution {
publicstaticvoidmain(String[] args) {
Scannersc=newScanner(System.in);
System.out.println("================================");
for(inti=0;i<3;i++)
{
Strings1=sc.next();
intx=sc.nextInt();
//Complete this line
System.out.printf("%-15s%03d\n", s1, x);
}
System.out.println("================================");
}
}