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
Answered By
4 Likes
Related Questions
Write a program that takes a number and check if the given number is a 3 digit number or not. (Use a loop to determine)
Write a program to input three numbers and print the largest of the three numbers.
Palindrome Number in Java: Write a program to accept a number from the user and check whether it is a Palindrome number or not. A number is a Palindrome which when reads in reverse order is same as in the right order.
Sample Input: 242
Sample Output: A Palindrome numberSample Input: 467
Sample Output: Not a Palindrome numberWrite a program to input a number in the range 10 to 100 and check if it is a prime number.