Pronic Numbers

Given a starting number and the ending number the task is to find the all the Pronic Number present in that given range and also to display it’s frequency.

Pronic Number is a number which is product of two consecutive numbers.

Example 1: 20. 4 x 5 = 20. We observe 4 and 5 are consecutive whose product is 20. hence it is a Pronic Number.

Example 2: 9 is not an product of two consecutive numbers. Hence it is not an Pronic Number.

Java
import java.util.*;
public class PronicNumberRange
{
    public static void main(String args[])
    {
        int start=0,end=0,frequency=0;
        Scanner sc=new Scanner(System.in);
        System.out.print("Enter a starting range: ");
        start=sc.nextInt();
        System.out.print("Enter a ending range: ");
        end=sc.nextInt();
        System.out.println("Pronic Numbers in the given range are:-");
        for(int i=start;i<=end;i++)
        {
            for(int j=1;j<=i;j++)
            {
                if(j*(j+1)==i)
                {
                    System.out.println(i);
                    frequency++;
                    break;
                }
            }
        }
        System.out.println("Frequency: "+frequency);
    }
}
Java