Home Discussion Discuss: Prime Number in Java

  • do thankshassan bakri June 30, 2011 at 12:29 PM

    it's good for Professionals but not to beginners can you type an easy one (just by using for loop that is test if the Entered number is prime or not ) And thanks

  • CommetsNagaveni katakar August 25, 2011 at 4:59 PM

    I like this tutorial its very much helpful for us. Weldone. Keep it up

  • java programskusum sorout August 27, 2011 at 11:03 PM

    what is the difference between buffer reader class and scanner class??

  • prime nuberssrilatha August 31, 2011 at 10:53 AM

    can you explain this program

  • HelloAthreya September 16, 2011 at 12:55 AM

    How to find the sum of all the prime numbers between 1 to 100?

  • Java programmingMehta Vidhi September 17, 2011 at 7:08 PM

    ok , i will try this program

  • give me program for primevijaya February 1, 2013 at 5:24 PM

    please give program for a number is prime number or not if not means print previous prime number.

  • prime number or not in javasoma nageswararao October 22, 2011 at 10:44 AM

    programing is currect,but programing only files concepts we will apply. general programing any concept will be the apply programing is currect. ok THANK YOU.

  • how it will workschandra November 1, 2011 at 11:34 AM

    i need clean explaination how this program will be executed?

  • sugsiva December 12, 2011 at 4:09 PM

    it's better to give out put

  • hmmmmmeditha maritoņa January 6, 2012 at 7:05 AM

    i dont knw how to comments,but i want to loearn more About java programs

  • javapinky January 19, 2012 at 10:12 PM

    sooo goood program

  • Program contains errorssmithzz January 28, 2012 at 5:16 PM

    This program may not show the results when the input number is 2. But I think it can be solved by changing the two for loopings for (i=1; i <= num; i++ ) and for (j=2; j<i; j++). This is my suggestions. With best wishes.

  • Exam code java...Orlan Villarino March 30, 2012 at 11:41 AM

    how am i going to run the example code of sorting

  • Exam code java...Orlan Villarino March 30, 2012 at 12:28 PM

    how am i going to run the example code of sorting

  • javaANAND KUMAR YADAV July 2, 2012 at 10:45 PM

    good solution

  • javaTasnim August 17, 2012 at 6:38 AM

    Sir, I am studing in MCM II but stil i don't have any cammand on java and i want to learn java very well. I kindly request to you plz guide me .

  • Technical programmingWelile September 25, 2012 at 9:33 PM

    in this program you must typed in the whole numbes finishing when the negative number typed in. For each integer entered, the program should also print outthe number of primes found

  • how does this work?Faisal khan October 21, 2012 at 6:23 PM

    how does this code work? i mean it's ok but explain it how the code will run? qhats the method behind it? u got my point right?

  • helpcalm April 14, 2013 at 10:06 PM

    if (n==0){ break; } what does it do?

  • primesubu July 15, 2012 at 7:56 PM

    import java.io.*; import java.util.Scanner; class prime { public static void main(String args[]) {Scanner sc=new Scanner(System.in); System.out.print("enter the value="); int p=sc.nextInt(); if((p==2) || (p==3) || (p==5)) { System.out.println("the value is prime no."); } else if((p%2)==0||(p%3)==0||(p%5)==0) { System.out.println("the value is not prime no."); } else System.out.println("the value is prime no."); } }

Post your Comment



Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Related Articles
Development process Questions

prime number
prime number  get one number and check the number prime or not using if statement   Java Check Prime Number 

Development process Questions

prime number
prime number  check prime number using if statement   Java Check Prime Number 

Development process Questions

prime number
prime number  check prime number using if statement   Java Check Prime Number 

Java Beginners

Armstrong number
Armstrong number  I want java program for Armstrong number 

Java Beginners

prime number
prime number  HI!I want a java program that accepts a number from user and displays whether it is a prime number or not using BufferedReader 

Java Beginners

prime number
prime number  To check a number entered by user is prime or not?   Java check prime number import java.util.*; class CheckPrimeNumber... is Prime!"); } else{ System.out.println("Number 

Java Interview Questions

number - Java Interview Questions
number  apka number kya hai aap apna number mera id per send ker do 

Java Beginners

getting random number in java
getting random number in java  getting random number in java Hi... and scaling the random number in my Java Random number eample. but for some reason... to generate the random number in Java Thanks in Advance 

Java Beginners

prime number - Java Beginners
prime number  this project is to determine if a phone number is a prime number. if the number is a prime number then print a message to the effect. if the number is not a prime number then print the prime factors of the number 

Java Beginners

add number - Java Beginners
add number  Q. write a programe to add three number. The number input... input=new Scanner(System.in); System.out.println("Enter first number"); int a=input.nextInt(); System.out.println("Enter second number"); int b 

Java Beginners

Number Convert - Java Beginners
Number Convert  Dear Deepak Sir, I am entered in Command prompt... passString(int number){ int num, q ; if (number < 10 ){ displayOutput(a[number]) ; } if (number > 9 && number < 20 ){ displayOutput(c[number-10 

Java Beginners

number of stairs - Java Beginners
number of stairs  1. Write a program that prints an n-level stair case made of text. The user should choose the text character and the number...(); } } } ----------------------------------- read for more information, http://www.roseindia.net/java/master 

Java Beginners

perfect number - Java Beginners
perfect number  An integer number is said to be a perfect number.... For example, 6 is a perfect number because 6 = 1+2+3. Write a method perfect that determines if parameter number is a perfect number. Use this method 

Java Beginners

Magic number in java
Magic number in java  Hi.. Can any one tel how to watch a magic number of a program?   import java.util.*; class MagicNumber...); System.out.print("Enter the number: "); int num =input.nextInt(); int b=0,x 

Java Beginners

prime number - Java Beginners
prime number  i want to write a code in java that picks prime numbers... non prime numbers when prime numbers are finished   Hi Friend, Try... boolean isPrime(int number){ boolean isPrime=false; int i 

Java Beginners

GUESS NUMBER - Java Beginners
GUESS NUMBER  Create a guessing game that picks a random number...() { super("Guess Number"); randomNumber = new Random().nextInt(100) + 1...); panelBottom.add(comment, BorderLayout.SOUTH); panel.add(new JLabel(" Guess a number from 

Java Beginners

Magic number Java Program
Magic number Java Program  write a program that guesses what number the user is thinking of. Below is a sample transcript: Think of a number between 1 and 255. I will guess the number you are thinking of. 1 3 5 7 9 11 13 15 17 

Java Beginners

program on factorial of a given number in java
program on factorial of a given number in java  please tell me, how to write program on factorial of a given number in java 

Java Beginners

program on factorial of a given number in java
program on factorial of a given number in java  please tell me, how to write program on factorial of a given number in java 

General

Convert Number to Roman Number Using Java
Java Convert Number to Roman Numerals In this section, you will learn how to convert the number to roman number.  To do this, we have created a class... and the method convertIntegerToRoman(int n) convert the specified number into roman 

Java Code Examples

Java reverse number
Java reverse number In this tutorial, you will learn how to reverse a number in java. In java, you can use arithmetic operators like division operator(/) and remainder operator(%) to reverse the number. The division operator returns 

Java Beginners

javascript max number - Java Beginners
javascript max number  hi all, i m trying to find maximum number...: var number,i,max; for(i=1;i<11;i++) { number=prompt("Enter a number"); if(i==1) max=number; document.write("Number 

Java Beginners

java number to word - Java Beginners
java number to word  Can somebody please fix this to come out with the word, not the number 23? import java.util.Scanner; public class... " + "position followed by 5 integers \nspecifying the number 

Java Beginners

from number to word
from number to word  i want to know weather there is any method that can be use in changing value from number to word. Example if i write ten thousand, it will automatically be written as 10000.   Java convert number 

Java-Tutorials

Prime Number program in Java
Prime Number program in Java will print the prime numbers between 1 to any given number. Prime Number is a number that is not divisible by any number other... automatically prints Prime Number starting from 1 to 50. Example of Prime Number 

General

Java get number of Processors
Java get number of Processors   ... of processors available in Java Virtual Machine. To display the number...("Number of processors available to the Java Virtual Machine 

Java Interview Questions

guess number - Java Interview Questions
guess number  i am doing a java program for user to guess number. i...) { input=JOptionPane.showInputDialog("Invalid number!Please re-enter... .."); private int randomNumber; public guess2() { super("Guess Number 

Java Beginners

list file number - Java Beginners
list file number  sir you still haven't understand my problem. i have to list out only the number of files in a given directory,your solution still give number of (files+directories) in given directory. are jfilechooser provide 

Java Beginners

Random Number Generation - Java Beginners
Random Number Generation  Can any one tell me about to generate integers that should be a 10 numbered integer. Should be between 100000000 to 9999999999. Core Application  Hi friend, Code to solve the problem 

Java Beginners

prime number question - Java Beginners
prime number question  For the question located here: http... has to input the two numbers and it displays the prime numbers within the range...; System.out.println("Prime Numbers between "+num1+" and "+num2 

DMCA.com