Ever wondered how to take input from the user to calculate and display the multiplication table of the given number from 1 to 10?This program can be solved by 2 methods, first one is long and time-consuming whereas the second one needs fewer lines of code but it is not beginners friendly.As always, start with the importing statement.public class MultiplicationTable { public static void main {Asking the user to input the number.Just a mathematical operation for 10 times with an increment.
System.out.println; System.out.println; System.out.println; System.out.println; System.out.println; System.out.println; System.out.println; System.out.println; System.out.println; System.out.println;Whole source code: import java.util.Scanner; public class MultiplicationTable { public static void main { Scanner in=new Scanner; int n; System.out.println; n=in.nextInt; System.out.println; System.out.println; System.out.println; System.out.println; System.out.println; System.out.println; System.out.println; System.out.println; System.out.println; System.out.println; } }is the same thing, since a number itself gets printed if you multiply it by 1.
Note: The second method requires basic knowledge of the while loop. it is recommended to learn about the
MayankVikash1 hey now
United States Latest News, United States Headlines
Similar News:You can also read news stories similar to this one that we have collected from other news sources.
Source: hackernoon - 🏆 532. / 51 Read more »
Source: hackernoon - 🏆 532. / 51 Read more »
Source: hackernoon - 🏆 532. / 51 Read more »
Source: hackernoon - 🏆 532. / 51 Read more »