Kodekraftt
/Blog
/Pronic Number In Java Definition Explanation Examples And Practice Problems
Join Early AccessContact UsPrivacy Policy
Java BasicsOOPsDSA with JavaQuizzesInterview Preparation

© 2026 KodeKraftt. All rights reserved.

Build smarter. Learn more. Innovate better.

Pronic Number in Java: Definition, Explanation, Examples, and Practice Problems

Learn what a Pronic Number is in Java with clear explanations, examples, and a complete Java program. Understand how to identify Pronic Numbers and practice with 3 coding challenges.

Pronic Number in Java: Definition, Explanation, Examples, and Practice Problems

A Pronic Number (also called a Rectangular Number or Oblong Number) is a number that is the product of two consecutive integers. These numbers appear in many mathematical problems and are a common topic in programming exercises involving number patterns.

What Is a Pronic Number?

A number N is a Pronic Number if it can be written as:

N = n × (n + 1)

That means the number is formed by multiplying two consecutive integers.

Examples of Pronic Numbers

  • 0 = 0 × 1
  • 2 = 1 × 2
  • 6 = 2 × 3
  • 12 = 3 × 4
  • 20 = 4 × 5
  • 30 = 5 × 6
  • 42 = 6 × 7

How to Check if a Number Is Pronic?

Steps:

  1. Loop from i = 0 up to the number.
  2. Check if i × (i + 1) equals the number.
  3. If yes → it is a Pronic Number.
  4. If no match is found → not a Pronic Number.

Java Program to Check Pronic Number


import java.util.*;

public class PronicNumber {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        System.out.print("Enter a number: ");
        int num = sc.nextInt();

        boolean isPronic = false;

        for (int i = 0; i * (i + 1) <= num; i++) {
            if (i * (i + 1) == num) {
                isPronic = true;
                break;
            }
        }

        if (isPronic) {
            System.out.println("Pronic Number");
        } else {
            System.out.println("Not a Pronic Number");
        }
    }
}

  

Examples Table

Number Expression Pronic?
6 2 × 3 Yes
20 4 × 5 Yes
56 7 × 8 Yes
15 Not applicable No
30 5 × 6 Yes

3 Practice Challenges

Challenge 1: List Pronic Numbers

Write a Java program to print all Pronic Numbers between 1 and 10,000.

Challenge 2: Pronic Count in Array

Given an array of integers, count how many of them are Pronic Numbers.

Challenge 3: Next Pronic Number

Write a Java program to find the next Pronic Number after a given number.

You might also like

Odious Number in Java: Definition, Rules, Examples, and Practice Problems

Learn what an Odious Number is in Java and number theory. Understand its definition, binary representation rules, examples, and how to check Odious Numbers using Java. Includes example table and 3 practice challenges.

Evil Number in Java: Definition, Examples, and Practice Problems

Learn what an Evil Number is in Java and number theory. Understand its definition, binary representation rules, examples, and how to check Evil Numbers using Java. Includes example table and 3 practice challenges.

Sunny Number in Java: Meaning, Explanation, Examples, and Practice Problems

Learn what a Sunny Number is in Java with definition, examples, logic, and a complete Java program. Understand how to check Sunny Numbers and practice with 3 coding challenges for students.

Buzz Number in Java: Definition, Rules, Examples, and Practice Problems

Learn what a Buzz Number is in number theory and Java programming. Understand its rules, examples, and how to check Buzz Numbers using Java. Includes sample program, table of examples, and 3 practice challenges.

Smith Number in Java: Definition, Steps, Examples, and Practice Problems

Learn what a Smith Number is in Java. Understand its definition, rules, examples, and how to check a Smith Number using Java. Includes detailed explanation and 3 practice challenges for students.

Duck Number in Java: Definition, Rules, Examples, and Practice Problems

Learn what a Duck Number is in Java programming. Understand its rules, see examples, and learn how to check a Duck Number using Java. Includes 3 detailed practice challenges.