Print Perfect Squares Till a Given Input Number - Java Quiz Question


Write a program to print perfect squares till a given input number. Spaces between the numbers are important and all the output should be in single line. Use System.out.println or System.out.print for printing.

Input Printed Output
125 1 4 9 16 25 36 49 64 81 100 121
50 1 4 9 16 25 36 49



class PrintPerfectSquaresTillAGivenNumber
{
    public static void main(String s[])
    {
        int input = 125;
        
        printPerfectSquares(input);

    }


    public static void printPerfectSquares(int input)
    {
    }

}