info@meritcampus.com    +91-85006-22255
...
`

Write a program to find the nearest perfect square of a given number. Assume that the given number is always greater than 2.

Input (Integer) Output (Integer)
`3` `4 (Since 3 is between 1 and 4, but nearer to 4 than 1)`
`9` `9 (Since 9 it is a perfect square)`
`10` `9 (Since 10 is between 9 and 16, but nearer to 9 than 16)`
`23` `25 (Since 23 is between 16 and 25, but nearer to 25)`
`17` `16 (Since 17 is between 16 and 25, but nearer to 16)`

``` class FindNearestPerfectSquare {     public static void main(String s[])    {        int input = 23;        int result = findNearestPerfectSquare(input);                System.out.println("The nearest perfect square for " + input + " is " + result);     }     public static int findNearestPerfectSquare(int input)     { ```
```     } } ```
Topic:

### User comments below.All of them might not be correct.

This dose is now closed and the winners are . The 'lucky liker' is Bhagi Bhagyasri. Please login into Merit Campus using facebook, to claim your recharge. Go to http://java.meritcampus.com/earnings to raise the recharge.

Posted by Merit Campus    2015-03-12 02:14:01