How to print to this star pattern? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to print to this star pattern?

* * * * * * * * * * * * * * *

1st Mar 2020, 6:23 AM
Amruta Dhokchaule
3 Answers
+ 6
1st Mar 2020, 6:51 AM
🌸 Elina RL Shah 🌸
🌸 Elina RL Shah 🌸 - avatar
+ 1
you can also use a while loop:- char *pattern = "*****"; while(*pattern){ printf("%s\n", pattern); pattern++; }
1st Mar 2020, 10:41 PM
rodwynnejones
rodwynnejones - avatar
+ 1
// Declare two variables int i, j; // for loop one for(i=5; i>0; i--) { // for loop two for(j=0; j<=i; j++) { // print * System.out.print("*"); } // print line System.out.println(); // Do it many times and edit it finally understand it one by one
2nd Mar 2020, 11:42 AM
Abdulmalik