+ 2

Print the pattern in java

1 3 5 7 9 11 13 15

2nd Mar 2019, 10:08 AM
Sunil Kumar
Sunil Kumar - avatar
4 Answers
+ 17
● might pattern is not correct, as the logic for number of elements in a row is not shown properly or incorrect, please correct that. //here is basic way to solve it, after correction : ● 1 outer loop for number of rows & inside it 2 inner loops(one for space in beginning of each row & 1 for printing odd numbers in each row).
2nd Mar 2019, 11:06 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 15
Use nested for loops And use one variable and intilize with 1 and increment with 2 in inner for loop becz in this pattern all the number are odd.
2nd Mar 2019, 10:59 AM
Sumit Programmer😎😎
Sumit Programmer😎😎 - avatar
2nd Mar 2019, 11:58 AM
Sarthak Pokhrel
Sarthak Pokhrel - avatar
+ 2
https://code.sololearn.com/cL2zZ5VfEcwh/?ref=app
2nd Mar 2019, 12:00 PM
Sarthak Pokhrel
Sarthak Pokhrel - avatar