Let’s learn pronic number in java.

## pronic number in java

pronic number is a number which is product of two consecutive integers. Number in the form “n * (n + 1)”. Pronic numbers is also called as rectangular numbers, oblong numbers and heteromecic numbers.

**For example:**

7 * 8 = 56 is pronic number

Here 7 and 8 are consecutive integers.

Another example:

8 * 9 = 72

Here 8 and 9 are consecutive integers.

Here are pronic numbers upto 500 – 0, 2, 6, 12, 20, 30, 42, 56, 72, 90, 110, 132, 156, 182, 210, 240, 272, 306, 342, 380, 420, 462.

Now let’s see pronic number program or program to check pronic number.

// pronic number program in java import java.util.Scanner; public class PronicNumberJava { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Please input a number: "); int number = sc.nextInt(); int pronic = 0; for(int p = 0; p < number; p++) { if(p * (p + 1) == number) { pronic = 1; break; } } if(pronic == 1) { System.out.println(number + " is a pronic number."); } else { System.out.println(number + " is not a pronic number."); } sc.close(); } }

**Output:**

Please input a number: 342

342 is a pronic number.

Please input a number: 240

240 is a pronic number.

Please input a number: 400

400 is not a pronic number.

Also read – java overview