# jav beginners

bhavna
jav beginners
Posted in : Java Beginners
pl. let me know the logic and the program to print the prime and twin prim numbers

thanks

January 15, 2010 at 10:33 AM

Hi Friend,

Try the following code:

class TwinPrimes{

public static void main (String args[]){
String primeNo = "";
int j=0;
int LastPrime = 1;
System.out.println("Twin Primes are:" );
for (int i = 1; i < 100; i++){
for ( j = 2; j < i; j++){
if (i % j == 0) {
break;
}
}
if (i == j) {
primeNo += i + " ";
if ((i - LastPrime) == 2){
System.out.println("("+(i - 2)+","+i +")");
}
LastPrime =i;
}
}
System.out.println("Prime Numbers are: "+primeNo);
}
}

Thanks

jav beginners - Java Beginners
jav beginners  pl. let me know the logic and the program to print the prime and twin prim numbers thanks  Hi Friend, Try the following code: class TwinPrimes{ public static void main (String
jav compolation error - Java Beginners
jav compolation error  find symbol error
jav-util.zip
jav-util.zip  i need to load a zipfile in to my class while executing and i have extract each file in that zip and a particular file content i need to desplay how can i do this please help me
Jav Applets - Applet
Jav Applets  I need to write a small payroll program, using applet, that provides a text field for the number of hours, a text field for the pay rate, and a non-editable text field for the output. It should also also provide
jav a - Design concepts & design patterns
jav a  Q.1. Write a program in Java to perform the addition of two complex numbers.   Hi Friend, Try the following code: public class ComplexNumber{ private int a; private int b; public ComplexNumber
beginners questions
beginners questions  I need all the possible Java beginners questions to prepare for an Interview
Beginners in Java
Beginners in Java  Hi, I am beginners in Java, can someone help me... tutorials for beginners in Java with example? Thanks.   Hi, want to be command over Java, you should go on the link and follow the various beginners
java beginners - Java Beginners
Java for beginners
Java for beginners  Java for beginners Which is the best resource... Java video tutorial for beginners. Thanks   Hi, Here are the best resources for Learning Java for beginners: Java Video tutorial Java tutorials
Java for beginners - Java Beginners
://www.roseindia.net/java/beginners/index.shtml Thanks
programming - Java Beginners
programming for java beginners  How to start programming for java beginners
java beginners doubt!
java beginners doubt!  How to write clone()in java strings
Good tutorials for beginners in Java
Good tutorials for beginners in Java   Hi, I am beginners in Java... in details about good tutorials for beginners in Java with example? Thanks.   ... the various beginners tutorials related to Java http://www.roseindia.net/java/beginners
Struts 2 tutorial for beginners with examples
Struts 2 tutorial for beginners with examples  Where is the Struts 2 tutorial for beginners with examples on your website. Thanks   Hi, We have collection of many tutorials for beginners on our website. You can learn
Which is the best Java tutorials for beginners?
Which is the best Java tutorials for beginners?  Hello, I am trying to find good tutorials for beginners. Which is the best Java tutorials for beginners? Thanks   Hi, Beginners should learn to develop simple programs
Java - Java Beginners
Java  how to declare arrays   Hi Friend, Please visit the following link: http://www.roseindia.net/java/beginners/array.shtml Thanks
Tutorial For Java beginners
Tutorial For Java beginners  I am beginners in Java. Is there any good tutorial and example for beginners in Java? I want to learn Java before Jan... of December 2013. Check the Java Beginners Java Tutorial section for tutorials
Java programming for beginners video tutorials
Java programming for beginners video tutorials  Hi, I am trying to find the Java programming for beginners video tutorials. Let's know the url... video tutorial for beginners. This pages includes many video tutorials
array - Java Beginners
array  WAP to perform a merge sort operation.  Hi Friend, Please visit the following link: http://www.roseindia.net/java/beginners/arrayexamples/mergeSort.shtml Hope that it will be helpful for you. Thanks
Queue - Java Beginners
Queue  i'm working with queue on java. since im beginners im asking for additional example programs on queue using java to enhance my knowledge. thanks so much for the help! God bless
java - Java Beginners
java  ...can you give me a sample program of insertion sorting... with a comment,,on what is algorithm..   Hi Friend, Please visit the following link: http://www.roseindia.net/java/beginners/arrayexamples
Program - Java Beginners
matrices - Java Beginners
matrices  Write a program to add the two matrices  Hi Friend, Please visit the following link: http://www.roseindia.net/java/beginners/MatrixSum.shtml Hope that it will be helpful for you. Thanks
basic java - Java Beginners
basic java  oops concept in java ?  Hi Friend, Please visit the following links: http://www.roseindia.net/java/beginners/oop-in-java.shtml http://www.roseindia.net/java/learn-java-in-a-day/oops.shtml Thanks
Learn PHP Tutorials for Beginners
Learn PHP Tutorials for Beginners  Hi, I am just pass-out from college and eager to learn the PHP. Can anyone suggest or provide me a resourceful information for php beginners. Thanks
stringbuffer - Java Beginners
://www.roseindia.net/java/beginners/StringBuffer.shtml http://www.roseindia.net/java/beginners/ Thanks
programmes - Java Beginners
://www.roseindia.net/java/beginners/MatrixMultiply.shtml http://www.roseindia.net/java/beginners/MatrixSum.shtml http://www.roseindia.net/java/java-conversion/Dividing-of-two
help - Java Beginners
to : http://www.roseindia.net/java/beginners/what-is-java.shtml http://www.roseindia.net/java/beginners/where-java.shtml http://www.roseindia.net/java/beginners/ Thanks