Results 1 to 2 of 2
Thread: Math: pentagonal numbers
 09232011, 04:42 PM #1Member
 Join Date
 Sep 2011
 Posts
 1
 Rep Power
 0
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" );
System

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; 09232011 at 05:26 PM.
Similar Threads

Pentagonal Number problem
By Jason in forum New To JavaReplies: 5Last Post: 09072011, 06:19 AM 
Without Using Java.lang.Math Square Root.. How to calculate of 2 given Numbers.
By javasri in forum Forum LobbyReplies: 3Last Post: 06302011, 09:01 PM 
Math problem Sum of a hundred 50 digit numbers.
By AcousticBruce in forum New To JavaReplies: 13Last Post: 12192010, 01:36 PM 
Math: pentagonal numbers
By Latanyar in forum New To JavaReplies: 7Last Post: 10102010, 03:14 PM 
Roundind up numbers using Math.ceil
By Allspark in forum New To JavaReplies: 1Last Post: 09082010, 05:15 AM
Bookmarks