Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save digvijaybhakuni/ca004be431014974f25c8ded9d953c6e to your computer and use it in GitHub Desktop.
Save digvijaybhakuni/ca004be431014974f25c8ded9d953c6e to your computer and use it in GitHub Desktop.
Java Output Formatting
import java.util.Scanner;
public class SolutionJavaOutString {
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();
System.out.printf("%-15s%03d\n", s1, x);
}
System.out.println("================================");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment