Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren0
How to print in c ++
Hello, so I have to input some char, for example " *" and cout it n times in each row, while every row has that charachter -n. e.g. I enter 5 and output is ***** **** *** ** * I don't have a code, and you don't have to give me the entire code, I just need some ideas how to do it using loop. Ty
2 Antworten
+ 5
Here's what you need to proceed:-
Starting from top, i th line have (n-i) "*"s in it.{ n = number of lines }
+ 4
Run two for loops ,outer one will run n times and inner one will run (n - outer loop current iteration value) ,so it will be like n-0,n-1,n-2,.....,n-(n-1)