forked from sPredictorX1708/Ultimate-Java-Resources
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaOutputFormatting.java
More file actions
19 lines (16 loc) · 590 Bytes
/
JavaOutputFormatting.java
File metadata and controls
19 lines (16 loc) · 590 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("================================");
for(int i=0;i<3;i++)
{
String s1=sc.next();
int x=sc.nextInt();
// -15 to left justify the string
// 03 to express the number with 3 digits
System.out.format("%-15s%03d%n", s1, x);
}
System.out.println("================================");
}
}