Archive Pages Design$type=blogging

Java (BlueJ) program to check for Pronic Number (Heteromecic Number)

Pronic Number :  A pronic number, oblong number, rectangular number or heteromecic number, is a number which is the product of two c...



Pronic Number : A pronic number, oblong number, rectangular number or heteromecic number, is a number which is the product of two consecutive integers, that is, n (n + 1).
The first few pronic numbers are:
0, 2, 6, 12, 20, 30, 42, 56, 72, 90, 110, 132, 156, 182, 210, 240, 272, 306, 342, 380, 420, 462 … etc.

Program Input:

import java.util.*;
class PronicNumber
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
         
        System.out.print("Enter a number : ");
        int n = sc.nextInt();
        int flag = 0;
    
        for(int i=1; i<=n; i++)
        {
            if(i*(i+1) == n)
            {
                flag = 1;
                break;
            }
        }
         
        if(flag == 1)
            System.out.println(n+" is a Pronic Number.");
        else
            System.out.println(n+" is not a Pronic Number.");     
    }
}

Alternate Program :

import java.util.*;
class PronicNumber
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
         
        System.out.print("Enter a number : ");
        int n = sc.nextInt();
        int k = (int)(Math.sqrt(n));
        if(k*(k+1)==n)
            System.out.println(n+" is a Pronic Number.");
        else
            System.out.println(n+" is not a Pronic Number.");     
    }
}

Output:

Enter a number : 110
110 is a Pronic Number.
 
Enter a number : 73
73 is not a Pronic Number.
 
Enter a number : 342
342 is a Pronic Number.
 
Enter a number : 15
15 is not a Pronic Number.

Connect With Us

Name

2017 3 Stoogies 4kids Action Adventure Alison Android Android Apps Android Games Animation Ant-Ageing Apple Apps Art astronomy Baahubali Basic Electronics Batman BBC Beginners Bible Bilderberg Group biology Block Diagram Blogging BlueJ Books BoomBeach Brand Business CAD Call Of Duty Cement chemistry Christian Bale Clan Wars Clash of Clans Clash Royale CoC Coinsrewarder collaborations Collections Comedy Comedy Heist Componets Computer Conspiracy Conspiracy Theories Conspiracy Theory Cooking Coursera Cowboy Craft Crime DAP Digg Discovery Channel Documentary Documentary Collections Download Drama earn Earn from home Earning Online Education edX Electronics EngagemeTV Entertainment Example Facts Family Fantasy Fashion Food Free Free Course Freebies Freemasons Functions Gadgets Gaming geography George Clooney Ghost Giants Guide haunting Health Historical drama History Horror Comedy Hugh Jackman i ICC Illusion India Instagram International Trade Intrigue iPad James Bond Khan Academy kids La La Land Lastfm learning Letters Of Credit Lifestyle LinkedIn Logan martial arts mashups mathematics maths Media Mobile Mobile Downloads Motivational Movies Mr. Bean murder Music Musical Drama Must Watch Myspace Mystery MYSTERY & INTRIGUE Nephilim Niche NPK Offers Ohm's Law OneAd opportunity Overview Parallel Circuit paranormal Parenting PC PC Downloads Pc Games Performances Photography physical training physics PLR Programming Rankings Raw Cashew Nuts Recipe Requirements Review Reviews Risks Romance Rules SBLC Sci- fi Sci-Fi Secret Societies serial killer Series Series Circuit Share Market Share Trading sites Social Soundcloud Spaghetti Westerns special report Specifications Spirititual SPOOFS sprituality Squidoo Stock Market Stock Trading story StumbleUpon Sugar Super Hero Super Heroes SWIFT Symbols Technology Thirukkural Thriller Tips & Tricks Tom Hanks Top 10 top 9 Tourism Town Hall Trailer Travel Trilogies truth tutorial TV Twitter UCP UCR Udemy Unboxing Under 30 Urea Video Vidya vox Virus Visual illusion war Yahoo Answers Youtube
false
ltr
item
World Networks: Java (BlueJ) program to check for Pronic Number (Heteromecic Number)
Java (BlueJ) program to check for Pronic Number (Heteromecic Number)
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEHwdffOnJeXMEmctNHUW71MH90UYQQuV3FWyG_FlEvSi4ukytKIv-Fha0YuheTwkd_aFEgTKGDdQokNovr39M7xvPKkM5TTJPo36lk_xsCWft3HaXjX7vv_G2zepBcyfBmMPGs6iaYSsN/s320/about-logo.jpg
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEHwdffOnJeXMEmctNHUW71MH90UYQQuV3FWyG_FlEvSi4ukytKIv-Fha0YuheTwkd_aFEgTKGDdQokNovr39M7xvPKkM5TTJPo36lk_xsCWft3HaXjX7vv_G2zepBcyfBmMPGs6iaYSsN/s72-c/about-logo.jpg
World Networks
http://worldnetworks2.blogspot.com/2016/04/java-bluej-program-to-check-for-pronic.html
http://worldnetworks2.blogspot.com/
http://worldnetworks2.blogspot.com/
http://worldnetworks2.blogspot.com/2016/04/java-bluej-program-to-check-for-pronic.html
true
7942442033980179459
UTF-8
Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago