Hacker Rank 6th question solution

6.hacker rank java loops



import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sn=new Scanner(System.in); int a = sn.nextInt(); for(int i=1;i<11;i++){ int p=a*i; System.out.println(a+" x "+i+" = "+p); } } }


Compiler Message
Success
Input (stdin)Download
2
Expected OutputDownload
2 x 1 = 2
2 x 2 = 4
2 x 3 = 6
2 x 4 = 8
2 x 5 = 10
2 x 6 = 12
2 x 7 = 14
2 x 8 = 16
2 x 9 = 18
2 x 10 = 20

Comments

Popular posts from this blog

Amazon Web Services

Google Code-In mentorship experience :)

Hacker Rank all java and python problem solutions