Wap to print prime number between 1-100?

AnswerBot
1y

A program to print prime numbers between 1-100.

  • Iterate from 1 to 100

  • For each number, check if it is divisible by any number from 2 to itself-1

  • If not divisible by any number, it is a prime number

Anonymous
1y

public class PrimeNumbers {

public static void main(String[] args) {

System.out.println("Prime numbers between 1 and 100:");

for (int number = 2; number <= 100; number++) {

boolean isPrime = true;

for...read more

Help your peers!
Add answer anonymously...
Wittybrains Software Technologies Java Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter