We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
// we need to get 3 inputs form the user // #3 For Strings.// #3 For Integers.importjava.util.Scanner;classSolution{publicstaticvoidmain(String[]args){// InputScannersc=newScanner(System.in);String[]userText=newString[3];int[]userNumbers=newint[3];for(inti=0;i<3;i++){userText[i]=sc.next();userNumbers[i]=sc.nextInt();}System.out.println("================================");//Outputsfor(inti=0;i<3;i++){System.out.printf("%-15s%03d%n",userText[i],userNumbers[i]);}System.out.println("================================");sc.close();}}
Cookie support is required to access HackerRank
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 →