Write a program to input a number and check and print whether it is a Pronic number or not.
Answers
Answered by
5
plzzzz mark it as brainliest answer
Attachments:
Answered by
2
Answer:
- A pronic number is a type of number which is a product of any two consecutive integers.
- A pronic number is a type of number which is a product of any two consecutive integers.It's a Java program i.e. the following program is written in Java programming language.
import java.util.Scanner;
public class PronicNumber
{
public static void main(String brain[])
{
Scanner promo=new Scanner(System.in);
System.out.println("Enter a number to be checked.");
int n=promo.nextInt();
for(int k=1;k<=n;k++)
{
if(n%k==0)
{
if((k+1)*i==n||(k-1)*i==n)
{
System.out.println("Entered number is Pronic.");
break;
}
else
{
System.out.println("No, the number is not Pronic number.");
break;
}
}
}
}
}
Similar questions