Thursday , August 17 2017
Home / JAVA / Program to check Pronic number

Program to check Pronic number

Pronic number in Java:

A Pronic number is a number which is the product of two consecutive integers, that is n*(n+1), Pronic number also express as (n² + n). A Pronic number is also known as oblong number, rectangular number or heteromecic number. There are 99 pronic numbers below 10,000.



Mathematical Properties:
Pronic numbers are even number. Therefore, all pronic numbers are multiples of 2, but 2 is composite number. There are two reasons for pronic number are even.

1.  If N=i*(i+1), then either i or (i + 1) has to be an even number. Since an even number multiplied by any integer is still an even number, so pronic numbers are even.
2.  Pronic numbers are twice of triangular numbers. The picture showing 12 is actually 2 × (3 + 2 + 1). pronicnumber example

There are no odd pronic number but there is a prime pronic number, the only even prime, 2.



0, 2, 6, 12, 20, 30, 42, 56, 72, 90, 110, 132, 156…


import java.util.*;
class PronicNumber
    public static void main(String args[])
        int a, i, j=0
        Scanner cy = new Scanner(;
        System.out.print("Enter a number : ");   //get a number to check pronic
        a = cy.nextInt();
        for(i=1; i<=a; i++)
            if(i*(i+1) == a)    //check number is multiple of two consecutive number or not
                j = 1;
        if(j == 1)      //print number is pronic or not
            System.out.println(a+" is a Pronic Number.");   
            System.out.println(a+" is not a Pronic Number.");      


Enter a number: 72
72 is a Pronic Number.

Enter a number: 112
112 is not a Pronic Number.

Enter a number : 110
110 is a Pronic Number.

Enter a number : 73
73 is not a Pronic Number.

Pronic number code in Java, BlueJ, C

Check Also

Java Program to find Mobius Function of number

Mobius Function Java Program:  The MOBIUS function µ(n) for a natural number N is defined as ...

Leave a Reply

Your email address will not be published. Required fields are marked *