FRom hackerrank

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
Solution in java -
import java.util.Scanner;
class Solution { 
 public static void main(String args[])
 {
     Scanner sc = new Scanner(System.in);
     int N = sc.nextInt();
     if(N>=1 && N<=20)
     {
       for(int i=1;i<11;i++) {
           int x = N*i;
           System.out.println(N+" x "+i+" = "+x);
       }
     }
 }
 }

2 Comments

  1. YOU SHOULD PROBABLY USE SYNTAX HIGHLIGHTER FOR YOUR CODE IT WILL BE AMAZING THEN.

    ReplyDelete
  2. Thank you dear for your suggestion, we will trying to work on your suggestion very soon.

    ReplyDelete

Post a Comment

Previous Post Next Post