Results 1 to 2 of 2
- 09-23-2011, 04:42 PM #1Member
- Join Date
- Sep 2011
- Rep Power
Math: pentagonal numbers
I am new at programming and don't understand it at all just want to pass the class need all the help I can get here goes I am writing a method that returns a pentagonal number.
public static int getPentagonalNumber(int n)
I have to write a test program that displays the first 100 pentagonal numbers with 10 numbers on each line.
This is what I have so far.
* @author tina
public class PentagonNumber
* @param args the command line arguments
public static void main(String args)
int n = 0;
int numPerLine = 10;
int formula = n *(3 * n - 1) / 2;
for (int k=1;k<10;k++)
for (n = 1; n>=100; n++)
Re: Math: pentagonal numbers
I'm not sure how to help you as there is no specific question anywhere in your initial post. You need to tell us specifically where your stuck. The more specific the question you can give us, usually the more specific the answer. Given your post above as it is just a reiteration of your requirements and some code, about all we can do is refer you to the Java tutorials.
Best of luck.
edit: also just so you know, I can't speak for the others, but this is a negative motivating factor for me: "don't understand it at all just want to pass the class". Personally, I get the most out of this site helping people who enjoy learning learn how to program in Java. I care little whether they pass this or that class, and care even less if they're not interested in programming. Again, that's just me. Again, best of luck.
Last edited by Fubarable; 09-23-2011 at 05:26 PM.
- By Jason in forum New To JavaReplies: 5Last Post: 09-07-2011, 06:19 AM
- By javasri in forum Forum LobbyReplies: 3Last Post: 06-30-2011, 09:01 PM
- By AcousticBruce in forum New To JavaReplies: 13Last Post: 12-19-2010, 02:36 PM
- By Latanyar in forum New To JavaReplies: 7Last Post: 10-10-2010, 03:14 PM
- By Allspark in forum New To JavaReplies: 1Last Post: 09-08-2010, 05:15 AM