We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,624 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

need help for drawing a christmas tree with 3 for loop in c program

need help !!!!
anyone know how to draw a christmas tree in c program with 3 for loop ????????????

3
Contributors
4
Replies
2 Days
Discussion Span
10 Months Ago
Last Updated
5
Views
on93
Junior Poster in Training
54 posts since Jul 2012
Reputation Points: -7
Solved Threads: 0
Skill Endorsements: 0
Infraction Points: 2

Here's the pseudocode, a little bit of thinking wouldn't have hurt you would it?

subalg. printChristmasTree(){
    for (i<-0, i<5) do
        for (j<-0, j<=i*2) do
            for (k<-5, downto i) do
                if (j=0) then
                    print space
                end_if
            print '*'
            end_for
        print new line
        end_for
    @print base of the tree
    end_for
end_Subalg.
Lucaci Andrew
Practically a Master Poster
649 posts since Jan 2012
Reputation Points: 91
Solved Threads: 91
Skill Endorsements: 11

wht is the "do" represent ??? also a loop ???

on93
Junior Poster in Training
54 posts since Jul 2012
Reputation Points: -7
Solved Threads: 0
Skill Endorsements: 0
Infraction Points: 2
WaltP
Posting Sage w/ dash of thyme
Team Colleague
11,404 posts since May 2006
Reputation Points: 3,421
Solved Threads: 1,055
Skill Endorsements: 36

wht is the "do" represent ??? also a loop ???

Represents an action, what should the for DO with the given conditions/inputs.

Lucaci Andrew
Practically a Master Poster
649 posts since Jan 2012
Reputation Points: 91
Solved Threads: 91
Skill Endorsements: 11

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.1090 seconds using 2.73MB