#C program help please

29 messages · Page 1 of 1 (latest)

dusk sleet
#

Please , tell how to use the logic for this using loops, i am new to programming

glad dagger
#

You first want to break it up into "blocks"

#

An empty block (a space) and the asterisk block

#

Then try and find a pattern for when to place empty blocks and when to play asterisk blocks

#

Good luck!

dusk sleet
ruby silo
#

hint you'll use two loops

glad dagger
#

Oh yeah, you don't need to place empty block on the right side of the triangle as well (although it might be easier)

dusk sleet
#

Hmm, i am still trying

glad dagger
#

It hasn't been long. Keep trying and maybe ask for help if you're still stuck later

dusk sleet
#

Guys i almost got it but is there any way that i can remove those extra asteriks

glad dagger
#

Your steps are not correct

#

At least, that's why your output is not what's expected

dusk sleet
#

The required pyramid is in the pattern but i need a way to remove them

glad dagger
#

But that's why it's not correct

gusty magnet
gusty magnet
#

Hint: The number of spaces decrease as you go down the rows, and the number of stars increase as you down. Can you write a loop such that its number of iterations decreases after each iteration?

glad dagger
#

Maybe writing a table for the row number, number of space, and number of asterisks will help you figure out the pattern

dusk sleet
#

Ok then i will try it out

glad dagger
#

It's not a difficult problem to solve but it might just take some time. You should be able to do it with the hints we've given as anything more would've been the answer itself lol

dusk sleet
#

Guys thank you so much for your help i finally got it
I overthinked too much

#

Is this the one or any better way

#

Here's a chocolate for helping me finish my homework 🍫

gusty magnet
#

Jeez indent your code

dusk sleet
#

Ok!

glad dagger
#

use screenshots lol

delicate glade