+ 1

Loop structure

Like # # # # # #

21st Feb 2023, 9:38 AM
Kesaba Khuntia
Kesaba Khuntia - avatar
7 Respostas
+ 3
Kesaba Khuntia: 1. write a for() loop that executes three times. 2. Each time through the loop, print one more '#' than the previous time. There are a number of ways to do step 2. Here are some ideas: - build a string, adding '#' each time through the loop - use a nested loop where the inner loop prints '#' a number of times based on the outer loop index - create an array of strings like {'#", "##", "###"} and print the string at the current loop index. - create a string like "###" and use a printf() field width format specifier that limits how many characters to print based on the loop index.
21st Feb 2023, 2:44 PM
Brian
Brian - avatar
+ 3
Kesaba Khuntia So What is your question? we are all not able to complete your homework. if you facing any problem,then share your attempt?
21st Feb 2023, 9:54 AM
Darpan kesharwani🇮🇳[Inactive📚]
Darpan kesharwani🇮🇳[Inactive📚] - avatar
+ 3
Kesaba Khuntia I listed four ideas for how to add increasing numbers of '#' characters. Any one of them would work. The last one is the simplest.
21st Feb 2023, 4:29 PM
Brian
Brian - avatar
+ 2
To use the nested loop idea, set the inner loop range to go from 0 up to the outer loop index value.
21st Feb 2023, 4:59 PM
Brian
Brian - avatar
0
# ## ### Like loop structure making code in C
21st Feb 2023, 9:55 AM
Kesaba Khuntia
Kesaba Khuntia - avatar
0
But how to increase the no.of # as the loop execution going on
21st Feb 2023, 4:26 PM
Kesaba Khuntia
Kesaba Khuntia - avatar
0
In nested loop how to increase #
21st Feb 2023, 4:51 PM
Kesaba Khuntia
Kesaba Khuntia - avatar