# Check whether number is Pronic Number or Not

A Number is a Pronic number which is the product of two consecutive integers, that is, a number of the form num(num+1).

Example:

Given Number=90
product of two consecutive number 9*10=90
so, 90 is a Pronic Number.

Given Number=80
there are no consecutive multiple presents.
That's why 80 is not a  Pronic Number.

Problem statement:-  Program to check whether the number is Pronic Number or Not.

Data requirement:-

Input Data:- num

Output Data:- String output

Program in C

Here is the source code of the C Program to check whether the number is Pronic Number or Not.

Code:

//Pronic Number Or Not
#include<stdio.h>
int main()
{
int num;
printf("Enter the number:");
scanf("%d",&num);
int flag=0,i;
for(i=0;i<=num;i++)
{
if(i*(i+1)==num)
{
flag=1;
break;
}
}

if(flag==1)
printf("It is a Pronic Number.");
else
printf("It is not a Pronic Number.");
}

Input/Output:
Enter the number:90
It is a Pronic Number.

Program in C++

Here is the source code of the C++ Program to check whether the number is a Pronic Number or Not.

Code:

#include <iostream>
using namespace std;
int main()
{
int num,i;
cout<<"Enter the number:";
cin>>num;
int flag=0;
for(i=0;i<=num;i++)
{
if(i*(i+1)==num)
{
flag=1;
break;
}
}

if(flag==1)
cout<<"It is a Pronic Number.";
else
cout<<"It is not a Pronic Number.";
}

Input/Output:
Enter the number:80
It is not a Pronic Number.

Program in Java

Here is the source code of the Java Program to check whether the number is a Pronic Number or Not.

Code:

import java.util.Scanner;
public class PronicNumberOrNot {

public static void main(String[] args) {
Scanner cs=new Scanner(System.in);
int num;
System.out.println("Enter a number:");
num=cs.nextInt();
int flag=0,i;
for(i=0;i<=num;i++)
{
if(i*(i+1)==num)
{
flag=1;
break;
}
}

if(flag==1)
System.out.println("It is a Pronic Number.");
else
System.out.println("It is not a Pronic Number.");
cs.close();
}
}

Input/Output:
Enter a number:
72
It is a Pronic Number.

Program in Python

Here is the source code of the Program to check whether the number is Pronic Number or Not.

Code:

import math
num=int(input("Enter a number:"))
flag=0
for i in range(0,num+1):
if i*(i+1)==num:
flag=1
break
if flag==1:
print("It is a Pronic Number.")
else:
print("It is Not a Pronic Number.")

Input/Output:
Enter a number:302
It is Not a Pronic Number.

More:-