next perfect squire java

Solutions on MaxInterview for next perfect squire java by the best coders in the world

showing results for - "next perfect squire java"
Valentino
27 Sep 2020
1
2public class nextperfectsquare {
3    public static void main(String[] args) {
4        int a=15;
5        int result=isPerfectSquare(a);
6        System.out.println(result);
7    }
8    
9    static int isPerfectSquare(int num){
10         int square = 0; int i = 0; int result = 0;
11         for( i=0;i<num+1;i++){
12             System.out.println(i);
13             square=i*i;
14             if(square>=num){
15                 result=square;
16                 break;
17             }
18             
19         }
20
21        return result;
22        
23    }
24}
25