Write a code of prime numbers 1 to 100 and write sql query.

AnswerBot
2y

Code for prime numbers 1 to 100 and SQL query.

  • Use a loop to iterate through numbers 1 to 100.

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

  • If not divisible, it is a prime ...read more

Sai Patnaik
1y

SQL query: SELECT * FROM table_name WHERE number_column >= 1 AND number_column <= 100 AND is_prime = true;

code:

import java.util.*;

public class Main {

public static void main(String args[]){

int num;

Scanner sc = new Scanner(System.in);

num = sc.nextInt();

int c = 0;

for(int i=0; i<=num; i++){

if(i%num == 0)

c++;

}

if(c == 2){

System.out.println("Prime No.");

}else{

System.out.println("Not a Prime No.");

}

}

}

Help your peers!
Select
Add answer anonymously...

Accenture Java Developer interview questions & answers

A Java Developer was asked 5mo agoQ. What is the Java programming language?
A Java Developer was asked 5mo agoQ. Is Java considered a purely object-oriented programming language?
A Java Developer was asked 9mo agoQ. What happens if the application properties file is removed?

Popular interview questions of Java Developer

A Java Developer was asked 5mo agoQ1. What is the Java programming language?
A Java Developer was asked 5mo agoQ2. Is Java considered a purely object-oriented programming language?
A Java Developer was asked 6mo agoQ3. Given a string, how would you count the number of words in it?
Accenture Java Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

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

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits