answersLogoWhite

0


Best Answer

public class v3

{

public static void main()

{

int b=0,i;

for(i=1;i<=100;i++)

{

for(j=1;j<=i;)

{

if(i%j==0)

{

b=j;

System.out.print(b+" ");

b=0;

}

}

}

}

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

Implement this method:

public static boolean prime(int n) {

if(n 0) return false;

}

return true;

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Find out prime number between 1 to 100 in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a java programme to check whether the number is twin prime or not?

Find a prime number, add 2 to the number. Check if the new number is prime. IE : 3 is prime. 3+2 =5. 5 is prime. (3,5) are twin primes.


Java source code to find prime number?

/* Program to Find whether number is Prime or Not. */ class PrimeNo{ public static void main(String args[]){ int num = Integer.parseInt(br.readLine()); int flag=0; for(int i=2;i


How do you print non-prime numbers in java?

Loop through some numbers - for example, 2 through 100 - and check each one whether it is a prime number (write a second loop to test whether it is divisible by any number between 2 and the number minus 1). If, in this second loop, you find a factor that is greater than 1 and less than the number, it is not a prime, and you can print it out.


Write a java program to display the number is prime or not?

Simply use a for loop (i) that runs from 2 to N-1. Checking if N % i 0 then its a prime number.


To find strong number in java?

sir , what is perfect no?


Can you get a Java program to find the cube of a number?

Yes


How can you declare a number is prime or not in java programming?

Any prime number has only two factors which are itself and one whereas composite numbers all have more than two factors


How do you find out whether Java is installed on Linux?

Enter "java -version" into a terminal. If Java is installed, it will tell you the version number. If it is not installed, it will say "command not found."


Where can one find a Java development kit?

Java Development Kits are best found on the Java website. There are a number of programmes that can be downloaded. It is also possible to get Java Development Kit downloads from the Oracle website.


How do you find a system number in a JAVA program?

If by system number you mean the version number of the Java language on the client computer, you can useSystem.getProperty("java.version"); .Or, if you want the Java virtual machine version number you can use System.getProperty("java.vm.version"); .Finally, if you want the version number of the operating system, you can use System.getProperty("os.version"); .


Which math function is used to find the square root of a number using java?

Math.sqrt(number) function is used to find the square root of a number.. try it


How do you write a java program to find the square root of a number?

You can use the Math.sqrt() method.