Hackerrank - Java Solution - Java Output Formatting - Online Judge Solution

Latest

It is a free Online judges problems solution list. Here you can find UVA online Judge Solution, URI Online Judge Solution, Code Marshal Online Judge Solution, Spoz Online Judge Problems Solution

Tuesday, December 12, 2017

Hackerrank - Java Solution - Java Output Formatting

Hackerrank - Java Solution - Java Output Formatting

HackerRank Problem Solution

Problem Name - Java Output Formatting
Problem Link -  https://www.hackerrank.com/challenges/java-output-formatting/problem
Level - Introduction Challenges
Online Judge - HackerRank

Java Code
import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("================================");
        for (int i = 0; i < 3; i++) {
            String s1 = scan.next();
            int x = scan.nextInt();
            System.out.format("%-15s%03d%n", s1, x);
        }
        scan.close();
        System.out.println("================================");
    }
}


Tags: HackerRank Online Judge Solution, HackerRank OJ Solution list, HackerRank Problems Solution, HackerRank solver, HackerRank all problem solution list, HackerRank solution in java, Hackerrank Java Solution, Hackerrank - Java Solution - Java Output Formatting

1 comment: