Write a program to print even and prime numbers from 100 to 200 in core java language?

Java

1 answer

Answer

1032596

2026-04-20 05:25

+ Follow

I could write the program quickly, but I want to leave you part of the fun.

Just write a loop for the numbers from 2-100 (1 is not considered a Prime number). Write a second loop to test divisibility of each number, "n", with all factors lower than that number (from 2 to n-1). If such a factor exists, the number is NOT a prime number.

To test for divisibility, use the remainder of a division.

if (n % factor == 0)
// If true, it is divisible.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.