Find a number is pronic or not.

Write a program to find a number is pronic or not.

import.java.*;

class PronicNumber

{

    public static void main()

    {

        System.out.println("Enter a number");

        Scanner in = new Scanner(System.in);

        int x = in.nextInt();

        int ans=0;

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

        {

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

            {

                ans = 1;   break;

            }

        }

        if(ans == 1)

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

        else

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

    }

}



For Any Desired Program comment below. WE WILL TRY OUR BEST TO MAKE THAT PROGRAM AVAILABLE.

Comments

Popular Posts