make coding a program to display the output as below (with do while) : | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

make coding a program to display the output as below (with do while) :

high hill : 4 //input the amouny of the hill : 2 //input output : * ** *** **** *** ** * * ** *** **** *** ** *

15th Apr 2017, 8:30 AM
Ike Antika
Ike Antika - avatar
11 Answers
+ 23
need *answer
15th Apr 2017, 8:33 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 11
@Leon lit Have you got some time to do it? I'm afk now...
15th Apr 2017, 8:54 AM
Tashi N
Tashi N - avatar
+ 10
@Ike What is your question? You see that people don't get it. Pls add some more description.
15th Apr 2017, 8:45 AM
Tashi N
Tashi N - avatar
+ 8
for(int i=0; i < B; i++) { for(int x=1; x < 2 * A; x++) { for(int j=0; j < ((x <= A) ? x : (2 * A) - x); j++) { System.out.print("*"); } System.out.println(); } }
15th Apr 2017, 8:54 AM
Cyrus Ornob Corraya
Cyrus Ornob Corraya - avatar
+ 6
need question || need answers 😕😕😕
15th Apr 2017, 8:37 AM
Leon lit
Leon lit - avatar
+ 6
are you asking how to make a pattern like that???
15th Apr 2017, 8:46 AM
Leon lit
Leon lit - avatar
+ 6
//A is the high hill : 4 //B is the amouny of the hill : 2 int i = 0; while(i < B) { int x = 1; while(x < 2 * A) { int j = 0; while(j < ((x <= A) ? x : (2 * A) - x)) { System.out.print("*"); j++; } System.out.println(); x++; } i++; } //This will do the work. :)
15th Apr 2017, 9:09 AM
Cyrus Ornob Corraya
Cyrus Ornob Corraya - avatar
+ 4
A slow and long and ugly but recursive solution: https://code.sololearn.com/cdyHiCsM0Qto/?ref=app
15th Apr 2017, 10:57 AM
Tamás Barta
Tamás Barta - avatar
0
yes Helpe me plis
15th Apr 2017, 8:32 AM
Ike Antika
Ike Antika - avatar
0
done add descriptions
15th Apr 2017, 8:52 AM
Ike Antika
Ike Antika - avatar
- 1
no. question with while no for
15th Apr 2017, 8:58 AM
Ike Antika
Ike Antika - avatar