+ 25

[CHALLANGE] Pascal Triangle

Input(number of rows) = 6 output: 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 Create a program which will make such triangle 1>Using Arrays 2>Without using Arrays Good Luck :)

29th Oct 2017, 10:38 AM
Mr. Bot
Mr. Bot - avatar
14 Respuestas
+ 3
My two solutions. The two versions use the same formatting which allows for only 3 digit numbers and therefore loses its neatness when n exceeds 12. It still works. Using an array: https://code.sololearn.com/cBXDN7k81y0B/#java Without using an array. https://code.sololearn.com/c2l37lxXhPfr/#java
3rd Nov 2017, 4:49 AM
Bill Fisher
+ 26
here is my try // using both arrays and loops ☺ https://code.sololearn.com/c5g3Qt9Lqt5e/?ref=app
2nd Nov 2017, 5:20 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 14
https://code.sololearn.com/c2x6b0H46PM7/?ref=app
2nd Nov 2017, 5:17 PM
GAWEN STEASY
GAWEN STEASY - avatar
29th Oct 2017, 5:48 PM
Oma Falk
Oma Falk - avatar
2nd Nov 2017, 9:29 PM
David Akhihiero
David Akhihiero - avatar
29th Oct 2017, 11:12 AM
Αητοιπe
Αητοιπe - avatar
2nd Nov 2017, 7:21 PM
Takava Lim
Takava Lim - avatar
+ 5
Here is mine using arrays: https://code.sololearn.com/cAuablJG3TRE
29th Oct 2017, 3:08 PM
John Wells
John Wells - avatar
+ 4
https://code.sololearn.com/cRcxtbrhK28D/?ref=app
31st Oct 2017, 6:19 PM
Sudipta Kumar Nath
Sudipta Kumar Nath - avatar
+ 4
w/o arrays in c++ edit: w/ arrays in c++ edit: added a progarm with out using the x Choose y method. fixed both progarms, after re-reading challange. The Pascal Triangle row 0=1 and row 1 =1,1 yet the input is number of rows to print out including row 0, so I fixed my code to run the way the challange specified. https://code.sololearn.com/c2s4HEGHEX9S/?ref=app https://code.sololearn.com/c17F372suu6t/?ref=app https://code.sololearn.com/cvSEYEauGohr/?ref=app
1st Nov 2017, 9:49 AM
Joker
Joker - avatar
+ 3
for our webdesigner: if the even numbers get a different color the the odds... and the triangle is very big.... there is a wonderful pattern. for easiness dont print the numbers but different clored stars, depending on odd or even.
3rd Nov 2017, 5:52 AM
Oma Falk
Oma Falk - avatar
+ 3
Happy New Year to all. Here is my try https://code.sololearn.com/cAGqE8084Fh9/?ref=app
3rd Jan 2018, 6:54 PM
Hamid
Hamid - avatar
+ 2
Finally coded the non-array version. https://code.sololearn.com/c3b9ROBU06Z2/?ref=app
3rd Nov 2017, 2:56 AM
John Wells
John Wells - avatar
+ 2
when building, two lists are used: 1 - previous half-line of the triangle 2 - current half-line of the triangle The values of the central snake axis of a triangle are always one first element of the list. Additionally, the power of two is calculated as the sum of the elements of the line of the triangle, but according to the list of the current semi-line. Additionally calculated https://code.sololearn.com/WHcElo6SdLdU/?ref=app
10th Jan 2020, 6:49 PM
Michail Getmanskiy
Michail Getmanskiy - avatar