lab24c - previous row the ith value in the previous row For...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Lab Goal : This lab was designed to teach you how to use a matrix, an array of arrays. Lab Description : Read in each number from the file and print out a pascal’s triangle of that size. Sample Data : 6 3 6 7 2 4 5 Sample Output : 1 1 1 1 2 1 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 1 1 1 1 1 1 1 2 1 1 3 3 1 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 © A+ Computer Science – Matrices - www.apluscompsci.com algorithm help Basic Pascal’s triangle rules are as follows. The first and last values of the row are always 1. The other values in the row are computed using the following formula : The ith value in the row = (i–1)st value of the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: previous row + the ith value in the previous row. For instance, the second value of the 4 th row is 3 because the 1 st and 2 nd values of the 3 rd row are 2 and 1. //BONUS +30 //OUTPUT EACH TRIANGLE //AS AN EQUILATERAL TRIANGLE 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 Computer Science I Lab 24C – PASCAL’S TRIANGLE Lab Value - 100 # of data sets in the file - 6 Files Needed :: PascalsTriangle.java Lab24c.java Lab24c.dat © A+ Computer Science – Matrices - www.apluscompsci.com...
View Full Document

This note was uploaded on 01/24/2011 for the course COMP SCI 543 taught by Professor Mark during the Spring '10 term at Brown College.

Page1 / 2

lab24c - previous row the ith value in the previous row For...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online