Computer Science, asked by Vaibhav4008, 10 months ago

Write a java program using loop to check whether a number is perfect square or not. ​

Answers

Answered by Anonymous
0

Answer:

Java Program to Check if a given Number is Perfect Number

  • public class Perfect.

  • int n, sum = 0;

  • Scanner s = new Scanner(System.

  • System. out. print("Enter any integer you want to check:");

  • n = s. nextInt();

  • for(int i = 1; i < n; i++)

  • if(n % i == 0)

  • sum = sum + i;

Answered by Anonymous
12

Answer :-

Java Program to Check if a given Number is Perfect Number

  • public class Perfect.

  • int n, sum = 0;

  • Scanner s = new Scanner(System.

  • System. out. print("Enter any integer you want to check:");

  • n = s. nextInt();

  • for(int i = 1; i < n; i++)

  • if(n % i == 0)

  • sum = sum + i;
Similar questions