2. Write a program in java to input any number and determine whether the number is RIWI NUMBER or not.
Answers
Answered by
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
Math,
4 months ago
Social Sciences,
4 months ago
Science,
4 months ago
Math,
9 months ago
Political Science,
9 months ago
India Languages,
1 year ago
Art,
1 year ago
English,
1 year ago