Click here to Skip to main content
11,926,982 members (54,094 online)
Rate this:
Please Sign up or sign in to vote.
See more: C
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) Big Grin | :-D

Thank you very much!!!!
Posted 27-Sep-12 3:21am
Edited 27-Sep-12 3:45am
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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
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 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!!!
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Rate this: bad
Please Sign up or sign in to vote.

Solution 3

You could write a LineCenter Function to print out.

For Example:

bool LineCenter(char *text, int maxlinelen);

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151126.1 | Last Updated 27 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100