Computer Science, asked by pratikhero21, 7 months ago

Write a Java program to input number and check and print whether it is a Pronic number or not .​

Answers

Answered by gamer7854
2

Answer:

Write a Java program to check whether a number is a Pronic Number or Heteromecic Number or not. A pronic number is a number which is the product of two consecutive integers, that is, a number of the form n

Explanation:

Answered by devsingh98011
9

Answer:

import java.util.Scanner;

public class Example13 {

   public static void main(String args[])

      {

       Scanner sc = new Scanner(System.in);

       System.out.print("Input a number : ");

       int num = sc.nextInt();

       int ans = 0;

   

       for(int i=0; i<num; i++)

       {

           if(i*(i+1) == num)

           {

               ans = 1;

               break;

           }

       }

         

       if(ans == 1)

           System.out.println("Pronic Number.");

       else

           System.out.println("Not a Pronic Number.");      

   }

}

Similar questions