Write a java program that calls following three methods that use for loops or nested for loops to produce the output described below. Needs to be written in one program, all three methods in one program. A method called multi that prints multiplication tables for numbers from 1 to 10.
- Write a java
program that calls following three methods that use for loops or nested for loops to produce the output described below.
Needs to be written in one program, all three methods in one program.
- A method called multi that prints multiplication tables for numbers from 1 to 10.
1 x 1 = 1
1 x 2 = 2
.
.
.
1 x 10 = 10
---------------------------
2 x 1 = 2
2 x 2 = 4
.
.
.
2 x 10 = 20
---------------------------
.
.
.
---------------------------
.
.
.
10 x 9 = 90
10 x 10 = 100
-----------------------------
- Method called triangle that prints following triangle pattern
1
12
123
1234
12345
- Method called reverse that reverses a string passed to this method as a parameter and returns the reversed string. Eg reverse(“string”) should return “gnirts”. Print out the reversed string in your main method.
Hint: Use CharAt or Substring methods from the String Class.
Introduction of the Program:
The Java Program prints the table from 1 to 10, triangle pattern, and reversed string of a given string using three different methods in one Java program. The methods are multi() to print table from 1 to 10, method triangle() to print triangle pattern, and reverse() to print reversed string.
Step by step
Solved in 3 steps with 1 images