How to draw a pattern like 👇 this using java or c | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to draw a pattern like 👇 this using java or c

******* ********* ************ ***************** // sleeping mountain! ************* *********** ********

4th Feb 2018, 1:35 PM
Jaison John
Jaison John - avatar
2 Answers
+ 15
1)let input be n(lets say odd) 2)for (n+1)/2 rows , starting from n stars (*****...n) , then increasing n stars by 2,3,4 3)for n/2 rows , starting from n+2*((n+1)/2) stars(or get the no. of stars in last rows of loop in 1)) , then decreasing thise stars by 4,3,2in each row
4th Feb 2018, 1:44 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
0
Use a for loop instead as in c
4th Feb 2018, 5:18 PM
Sumit Kumar
Sumit Kumar - avatar