Computer Science, asked by nisargapriya342, 9 months ago

3. Write a program to input a number and check and print whether it is a 'Pronic' number
or not. Use a function int Pronic(int n) to accept a number. The function returns 1,
the number is ‘Pronic', otherwise returns zero ().
(Hint: Pronic number is the number which is the product of two consecutive integers
Examples: 12 = 3 * 4
20 = 4 * 5
42 = 6 * 7​

Answers

Answered by Ankita2602
6

Answer:

Write a program to input a number and check and print whether it is a 'Pronic' number or not.

Use a function int Pronic() to accept a number. The function returns 1, if the number is 'Pronic',

otherwise returns zero 0.

(Hint: Pronic number is the number which is the product of two consecutive integers)

import java.util.Scanner;

public class PronicNumber

{

public static ______________ pronic() {

int isPronic = 0;

Scanner in = new Scanner(System.in);

System.out.print("Enter the number to check: ");

int n = in.nextInt();

for (int i = 1; i <= n - 1; i++) {

if (i * _______________== n) {

isPronic = 1;

break;

}

}

____________ isPronic;

}

public static void main() {

int __________ = pronic();

if (r == 1)

System.out.println( "Number is a pronic number");

else

System.out.println( "Number is not a pronic number");

Answered by warofgod647
4

Answer:

Tere to l lag Gaye Kya l ooooooooooooo

Similar questions