Java Loops I solution

Problem discussion

         In Java Loops I, you have to display the given format 10 times.
Format: N x i = result where N is the given number, i is 1 to 10 and the result is the multiplication of N and i. Now try to solve it. You may get help from the below code but at first try hard most. 

Source code

Before seeing the source code ensure that you have tried hard most!!! 

import java.util.Scanner;
public class Solution {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        for(int counter = 1; counter <= 10; counter++)
            System.out.printf("%d x %d = %d\n",N ,counter ,(N*counter));
    }
}
Be with us, stay happy. Please do your precious comment and give an opportunity to improve us.

Happy coding.

Leave a comment

Website Powered by WordPress.com.

Up ↑

Design a site like this with WordPress.com
Get started