Computing.Net > Forums > Programming > Java help to make Pascal Triangle

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Java help to make Pascal Triangle

Reply to Message Icon

Original Message
Name: wadood
Date: October 17, 2005 at 20:16:05 Pacific
Subject: Java help to make Pascal Triangle
OS: windows
CPU/Ram: pentium4
Comment:

I have been given an assignment to write a program that prints out a pascal triangle with the intended spacing. It is in Java.

I just cannot figure out the spacing.

Say the user enters 3

then the output should be as

1
1 1
1 2 1

I would appreciate any help

W

Wadood


Report Offensive Message For Removal


Response Number 1
Name: wadood
Date: October 17, 2005 at 20:19:00 Pacific
Reply: (edit)

Sorry the spacing between the numbers did not come out properly.

There should be at least two spaces between the outer 1s and the triangle in the shape of a pyramid. However, the spacing of the inner number changes from 5 spaces between the two 1's in the second row to 4 spaces between 15 and 20 in the 6th row.

I would appreciate any help

Wadood


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home








Do you own an iPhone?

Yes
No, but soon
No


View Results

Poll Finishes In 6 Days.
Discuss in The Lounge
Poll History




Data Recovery Software