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.
This is what I got but after reading the discussions, I a lot of people using the printf method. But this code here will do the same job. This code is in Java 8.
importjava.io.*;importjava.util.*;publicclassSolution{publicstaticvoidmain(String[]args){/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */Scannersc=newScanner(System.in);intinput=sc.nextInt();sc.close();for(inti=1;i<=10;i++){intanswer=input*i;System.out.println(input+" x "+i+" = "+answer);}}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Loops I
You are viewing a single comment's thread. Return to all comments →
This is what I got but after reading the discussions, I a lot of people using the printf method. But this code here will do the same job. This code is in Java 8.