Click here to Skip to main content
15,908,455 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hello, could you help me this please!

1.(1st program) Print to screen a triangle with this require: The "n"th row consists of n elements of Fibinacci sequence.
(I'm successfuly print the Fibonacci but do not know how to print it as a triangle)
2.(2nd program) Print to screen the Pascal Triangle...
(Really get stuck with this..know only the logic but can't find the algorithm to solve)

Please only use loop, condition,......i only know these!! (Beginer) :d

Thank you very much!!!!
Posted
Updated 11-Jul-16 3:55am
v3
Comments
Legor 27-Sep-12 8:25am    
No, we dont do other peoples homework. But we are willing to help if you have specific problems.
Minh Hikari 27-Sep-12 8:41am    
Yes. Sorry because i haven't said. I can print the Fibonacci, but don't know how to print it as an triangle.....that's the problem i'm having now....wait for me to edit the quesion.
Legor 27-Sep-12 9:05am    
Please do not use !!! after each sentence. It's called shouting in internet terms so when reading your messages one gets the feeling he is shouted at all the time which isn't very polite now is it?
Minh Hikari 27-Sep-12 9:11am    
oh. I don't know that.....thank you very much for telling me.

Have a look at this[^].
Or you could have googled it.

BTW no one would work for you for free. As its your homework, do it yourself. As you said, you are beginner, start with small programs like printing normal number sequence, then advance through step by step. Post the question if you are stuck with some code or logic, you'll definitely get help then.

All the best.
 
Share this answer
 
Comments
Minh Hikari 27-Sep-12 8:37am    
yes.tks... I have successfully with the Fibonacci...but don't know how to print it as a triangle....I "Goggled" it and can't find the solution. That's the problem....
Malli_S 27-Sep-12 8:39am    
Print spaces before digits to format it.
_ _ _ 1
_ _ 2 1 2
_ 3 2 1 2 3

In above stuff, '_' represents the space. Now did you get any clue? Try it.
Minh Hikari 27-Sep-12 8:48am    
uh!!! let's see.....this format.

1
1 1
1 1 2
1 1 2 3
1 1 2 3 5
1 1 2 3 5 8
1 1 2 3 5 8 13
.............

like that!!!
 
Share this answer
 
v2
You could write a LineCenter Function to print out.

For Example:

bool LineCenter(char *text, int maxlinelen);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900