Results 1 to 2 of 2
Like Tree2Likes
  • 2 Post By Fubarable

Thread: Math: pentagonal numbers

  1. #1
    pullinghair is offline Member
    Join Date
    Sep 2011
    Rep Power

    Default 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.

    package pentagon.number;
    import javax.swing.JOptionPane;
    * @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++)
    System.out.println(getPentagonalNumber(n)+"\t" );

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power

    Default 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.
    Norm and DarrylBurke like this.

Similar Threads

  1. Pentagonal Number problem
    By Jason in forum New To Java
    Replies: 5
    Last Post: 09-07-2011, 06:19 AM
  2. Replies: 3
    Last Post: 06-30-2011, 09:01 PM
  3. Math problem Sum of a hundred 50 digit numbers.
    By AcousticBruce in forum New To Java
    Replies: 13
    Last Post: 12-19-2010, 01:36 PM
  4. Math: pentagonal numbers
    By Latanyar in forum New To Java
    Replies: 7
    Last Post: 10-10-2010, 03:14 PM
  5. Roundind up numbers using Math.ceil
    By Allspark in forum New To Java
    Replies: 1
    Last Post: 09-08-2010, 05:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts