KnowledgeBoat Logo

Computer Applications

Write a program that prints the squares of 10 even numbers in the range 10 .. 100.

Java

Java Iterative Stmts

9 Likes

Answer

public class KboatSquares
{
    public static void main(String args[])  {
        
        System.out.println("Squares of even number:");
        System.out.println("Number\tSquare");
        
        for(int i = 10; i < 30; i += 2) {
            int sq = i * i;
            System.out.println(i + "\t" + sq);
        }
    }
}

Variable Description Table

Program Explanation

Output

BlueJ output of Write a program that prints the squares of 10 even numbers in the range 10 .. 100.

Answered By

4 Likes


Related Questions