Skip to content

Instantly share code, notes, and snippets.

@dan-dm
Created March 22, 2020 21:25
Show Gist options
  • Save dan-dm/fce724abcbfc401f806c6b5ad7c68a13 to your computer and use it in GitHub Desktop.
Save dan-dm/fce724abcbfc401f806c6b5ad7c68a13 to your computer and use it in GitHub Desktop.
Created with Copy to Gist
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();
int j = 15 - s1.length();
String stringSpaces = "";
do {
stringSpaces += " ";
j--;
} while (j > 0);
String intZeros = "";
if (x < 9)
intZeros = "00";
else if (x > 9 && x < 99)
intZeros = "0";
System.out.println(s1 + stringSpaces + intZeros + x);
}
System.out.println("================================");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment