answersLogoWhite

0


Best Answer

/* 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

User Avatar

Wiki User

8y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Java source code to find prime number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic

Why are prime numbers used in code creations?

I use prime numbers in code to catalog things with one number. I assign a prime number to a certain characteristic. Then I multiply together the prime numbers for each characteristic contained. Later, that number can be divided a prime number. If a remainder of zero is returned I know it contains the number and what too associate it with.


What is the pseudo code to delete prime numbers from linked-list?

It sounds like you're using Java, so instead of pseudo-code, I'll give you the actual code. LinkedList<Integer> l; // Let's assume you have a bunch of Integer values in this list. for (int i = 0; i < l.size(); i++){ int n = l.get(i); boolean prime = true; for (int i = 2; i < n; i++){ if (n % i == 0){ prime = false; break; } } if (prime){ l.remove(i); i--; } }


What is the code required to convert an integer variable to a string variable in Java?

There are several different methods to convert an integer variable to a string variable in Java. For example, one can use the following code to convert an integer variable to a string variable: Integer.toString(number)


What is the code of a c program that will read in a positive integer value and determine If the integer is a prime number and If the integer is a Fibonacci number?

see the program


How do you write a matlab code to check if a random number is prime or not?

My Code: ======================================… >> disp('input a pair of natural numbers, N and M with M>N'); N=input('N='); M=input('M='); for j=0:(M-N) Prime=1; for i=2:((N+j)/2) if mod((N+j),i)==0 Prime=0; break end end if Prime==1 disp('This is a Prime Number'); else disp('Not Prime'); end end

Related questions

Where does source code come from in java?

Source code comes from the programmer...


What kind of file contain java source code?

'.java' files contain java source code. One can access these files on windows by using 'notepad'.


What does the Java compiler translate Java source code to?

The Java compiler translates Java source code to Java byte code.


Java source code for median filter algorithm?

research is going on to develop a source code for median filtering using java


Differencitate between source code and bytcode in java?

The source code is just the set of statements written in (any included) java language by a programer (in this case our source code is a text file with .java extension). And in other hand a bytecode is the resulting code of compile a .java file, It is not machine code, but it can be interpreted and executed by the jvm.


What does a compiler perform?

A compiler converts high-level source code into native machine. In the case of Java, source code is compiled to Java byte code suitable for interpretation by the Java virtual machine which produces the machine code.


Where does bytecode come from java?

It is created by the Java compiler, based on the source code (the .java file).


How do you extract the java source code of a java based open source software?

If the software is open source then generally they will provide the code in a separate link. I don't think it is possible to reverse-engineer the code of a program.


What is a Javacode?

If someone talks about "Java code," then they're are most likely referring to the source code of a Java program.


Website of free java project to be download with source code?

which Website for free java project to be download with source code Free Download Project in asp.net,Java ,C#.Net ,Php on thisWebsite www.enggroom.com


What do you call a Program that runs Java byte code instruction?

Get the JDK & Bluej from net and the rest will be done by them. Java byte codes are stored as *.class ; where "*" represents the class name, in your hard disk. You can download BlueJ as well as JDK from the related link.


How is decoupling achieved in Java programs?

Decoupling is achieved in Java programs through the parser code. To debug the decoupling achieved in Java, run the source code over the parser code first.