Question: A hexagonal number is defined as 2n*(2n 1)/2 for n = 1, 2, , and so on. Therefore, the first few numbers are 1, 6,
A hexagonal number is defined as 2n*(2n 1)/2 for n = 1, 2, , and so on. Therefore, the first few numbers are 1, 6, 15, 28,
Write a method with the following header that returns a hexagonal number:
public static int getHexagonalNumber(int n)
Write a test program that calls this method to display the first 50 hexagonal numbers with 5 numbers on each line. Use printf to ensure the numbers are aligned to the right.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
