Answers for "write a program to input a number and check whether it is a pronic number or not blue j"

1

pronic number in java

import java.util.Scanner;
public class PronicNumberJava
{
   public static void main(String[] args)
   {
      Scanner sc = new Scanner(System.in);
      System.out.print("Please input a number: ");
      int number = sc.nextInt();
      int pronic = 0;
      for(int p = 0; p < number; p++)
      {
         if(p * (p + 1) == number)
         {
            pronic = 1;
            break;
         }
      }
      if(pronic == 1)
      {
         System.out.println(number + " is a pronic number.");
      }
      else
      {
         System.out.println(number + " is not a pronic number.");
      }
      sc.close();
   }
}
Posted by: Guest on October-30-2020

Code answers related to "write a program to input a number and check whether it is a pronic number or not blue j"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language