Math, asked by ansh876, 9 months ago

2. Write a program in java to input any number and determine whether the number is RIWI NUMBER or not.

Answers

Answered by llɱissMaɠiciaŋll
5

Step-by-step explanation:

Program in java:

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