Check if a given number is Pronic | Java program to check and Print Pronic Number upto 200 ; function to check Pronic Number ; Checking Pronic Number by multiplying consecutive numbers ; Driver Code ; Printing Pronic Numbers upto 200
import java . io . * ; import java . util . * ; import java . math . * ; class GFG { static boolean checkPronic ( int x ) { for ( int i = 0 ; i <= ( int ) ( Math . sqrt ( x ) ) ; i ++ ) if ( x == i * ( i + 1 ) ) return true ; return false ; } public static void main ( String [ ] args ) { for ( int i = 0 ; i <= 200 ; i ++ ) if ( checkPronic ( i ) ) System . out . print ( i + " ▁ " ) ; } }