Pronic Number

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.

C
#include <stdio.h>
void main()
{
    int n=0,flag=0;
    printf("Enter a number: ");
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        if(i*(i+1)==n)
        {
            flag=1;
            break;
        }
    }
    if(flag==1)
    {
        printf("%d is a Pronic Number",n);
    }
    else
    {
        printf("%d is not a Pronic Number",n);
    }
}
C