Write a program to print perfect squares in the given range. For e.g., 4, 9, 16, 25 etc are perfect squares. Spaces between the numbers are important. All the numbers should be in one line. Use System.out.println or System.out.print for printing.
Input (Integer, Integer) | Printed Output |
---|---|
1 to 10 |
4 9 |
9 to 49 |
9 16 25 36 49 |
3000 to 3300 |
3025 3136 3249 |
class PrintPerfectSquaresInRange
{ public static void main(String s[])
{
printPerfectSquaresInRange(10, 100);
}
public static void printPerfectSquaresInRange(int startValue, int endValue)
{
//Write code here to print the required perfect squares between the start value and end value. Use System.out.println or System.out.print for printing.
}
}
Topic: Nested for Loop In Java