You are viewing a single comment's thread. Return to all comments →
import java.util.Scanner;
public class Solution {
public static void formattedOuput(String[] words, int[] numbers) { System.out.println("================================"); for (int i = 0; i < 3; i++) { System.out.printf("%-15s%03d\n", words[i], numbers[i]); } System.out.println("================================"); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] words = new String[3]; int[] numbers = new int[3]; // Taking Input for (int i = 0; i < 3; i++) { words[i] = sc.next(); numbers[i] = sc.nextInt(); } // Printing Output formattedOuput(words, numbers); sc.close(); }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Java Output Formatting
You are viewing a single comment's thread. Return to all comments →
import java.util.Scanner;
public class Solution {
}