Home Tutorialhelp Comment Reply-how to write given no is prime or not plz pr

 
 

Comment

Selva
Reply-how to write given no is prime or not plz pr,
January 12, 2009 at 2:49 AM

import java.io.*;

class PrimeNumber {
public static void main(String[] args) throws Exception{
int i;
BufferedReader bf = new BufferedReader(
new InputStreamReader(System.in));
System.out.println("Enter number:");
int num = Integer.parseInt(bf.readLine());
int f=0;
for (j=2; j<num; j++){
if (num%j==0){
f=1;
break;
}
}
if(f==0){
System.out.print(i+"is Prime No.");
}else{
System.out.print(i+"is Not Prime No.");
}
}
}
}
View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
Java-Tutorials

Prime Number in Java
Prime Number in Java In this Java tutorial , you will learn how to write a Java program to get prime numbers between 1 to the desired number. To start with, we have defined a class "PrimeNumber" in this example. Java I/O package 

Java Beginners

prime numbers - Java Beginners
prime numbers  Write a java program to find the prime numbers between n and m 

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

prime number - Java Beginners
prime number  i want to write a code in java that picks prime numbers from an existing list regardless how long the list is, it should then select non prime numbers when prime numbers are finished   Hi Friend, Try 

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... program in Java: package Tutorial; public class PrimeNumber { public static 

Java Beginners

finding the prime numbers
about your problem. http://www.roseindia.net/java/beginners/Prime_number.shtml...finding the prime numbers  Hi, I am a beginner to java and I have... the problem. Thanks.   Want to know about how to find out the given 

Java Beginners

prime number
prime number  write a java program for prime number 

Java Tips and Examples

Prime number program in java
Prime number program in java In this example you will learn how to write a program to generate and check  prime number  in java. As we know prime... a class with class name prime number, using switch case, in case first using two 

Java Beginners

Finding all palindrome prime numbers - Java Beginners
Finding all palindrome prime numbers  How do i write a program to Find all palindrome prime numbers between two integers supplied as input (start and end points are excluded 

Java Beginners

Plz send - Java Beginners
Plz send  Hi, please send whole code i understood ur sending sql query Thanks  hai dear frnd........ look how can i write... be a troublesome...then again wat r ur needs.... so plz...provide a deatiled structure 

Java Beginners

Plz answer - Java Beginners
Plz answer  Create a Java Bean Class ?? Customer according to the below given class diagram. Customer... ------------------------------------------------- plz doreply me....thankz alot   

Java Beginners

prime pal - Java Beginners
prime pal  1) WAP to print all prime-palindrome number range between 1-500 2) WAP to print all prime-Fibonacci number range between 1-500   Hi Friend, 1)Prime and Palindrome: import java.util. 

Java Beginners

plz answer - Java Beginners
plz answer   Write a Binary Search program that searches an array of ordered data. Compose an ordered array of 500 integers that contains the following series of numbers and run the search on it: 1, 2, 3, 5, 8, 13, 21, 34, 55 

Java Beginners

plz help me - Java Beginners
plz help me  Deepak I can write a sessioon code plz help me admin_home.jsp page is display but data is not disply plz help me what is wrong 

Java Beginners

plz send immediately - Java Beginners
plz send immediately  Hi Deepak, How are you, Deepak I face some problem in my project,plz help me My Questin is user input... should be updated. plz write a code and immediate response its very urgent plz 

Java Beginners

plz help me - Java Beginners
is true...but i very confuse that how it is not displayed admin page plz any one give me reponse my persinal given id  Hi ragni, i am sending...plz help me  Thanks deepak continue response..i face some problem i 

Java Beginners

prime number question - Java Beginners
prime number question  For the question located here: http://www.roseindia.net/answers/viewanswers/5778.html How do you make it so that the user has to input the two numbers and it displays the prime numbers within the range 

Java Beginners

java coding help plz ?
java coding help plz ?  Given two integers N and M (N â?¤ M), output all the prime numbers between N and M inclusive, one per line. N and M will be positive integers less than or equal to 1,000,000,000. The difference 

Java Beginners

plz tell me the code & execution process - Java Beginners
plz tell me the code & execution process  Write a program to download a website from a given URL. It must download all the pages from that website... to : http://www.roseindia.net/java/network/ http://www.roseindia.net/java 

Java Beginners

plz tell me the code & execution process - Java Beginners
plz tell me the code & execution process  Write a program to download a website from a given URL. It must download all the pages from that website... is: "); System.out.println(str); } } For more information on Java 

Java Beginners

Plz help me in writing the code - Java Beginners
Plz help me in writing the code   Write a two user Chess Game. (users must be on different systems 

Java Beginners

Plz help me in writing the code - Java Beginners
Plz help me in writing the code   Write a two user Chess Game. (users must be on different systems 

Java Tips and Examples

Find out the prime number
to find out whether a given number is prime or not. Here we have used the 'for loop' statement and given the required condition for a prime number. As we know... Find out the prime number       

Java Beginners

ans plz
{ private PipedReader pr; private PipedWriter pw; MyThread1(PipedReader pr, PipedWriter pw) { this.pr = pr; this.pw = pw; } public void run() { try... Thread { private PipedReader pr; private PipedWriter pw; MyThread2(PipedReader 

Java Beginners

really need help on how to write this program plz some 1 help out. - Java Beginners
really need help on how to write this program plz some 1 help out.  i am confused here on what to write can some 1 help out here i dont quite understand how to code it so can some 1 help out. Part II Write, compile and execute 

Java Beginners

Plz chk it and reply again - Java Beginners
Plz chk it and reply again  Hi Deepak, Thanks for fast reply,your application is good,u write this code for user click the view database... will be slow also. so plz help me for this if u understood my question then plz 

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 Tips and Examples

Prime Number in Java
Prime Number in Java       This Java programming tutorial, we will be read how to get prime number between 1 to given number. First of all we have to define a class " 

Java Beginners

java, plz help me in doing this - Java Beginners
java, plz help me in doing this  # Write a small record management application for a school. Tasks will be Add Record, Edit Record, Delete Record, List Records. Each Record contains: Name(max 100 char), Age, Notes(No Maximum 

Java Beginners

can u plz try this program - Java Beginners
can u plz try this program  Write a small record management application for a school. Tasks will be Add Record, Edit Record, Delete Record, List.... --------------------- <%@ page language="java 

Development process Questions

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

Java Beginners

plz. answer my ques - Java Beginners
plz. answer my ques  I want to ask a prog. prob which would create... servlet is given as below: 1. Validation.java import java.io.*; import... was given by me just follow 2nd logic which contains two jsp fils "retry.jsp 

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

plz help - Java Beginners
plz help  i have to programs and it takes too long to run them so i..... but i dont know how to aplly that on my 2 programs: the first code... some operations ... how can i makes them as thread first code: import 

IDE Questions

prime palindrome
prime palindrome  Hi I want to write a program that ask a user to input a number, the program then list all the prime numbers that are palindrome below the number entered. In pascal language Thanks 

IDE Questions

prime palendrome
prime palendrome  Hi I want to write a program that ask a user to input a number, the program then list all the prime number that are palindrome below the number entered. Thks 

IDE Questions

prime palindrome
prime palindrome  Hi I want to write a program in pascal that ask a user to input a number, the program then list all the prime number that are palindrome below the number entered. thks 

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

prime number
prime number  to check wethere given number is prime or not?  ... is Prime!"); } else{ System.out.println("Number is not prime!"); } } } Thanks 

Java Interview Questions

PRIME AND EVEN AND ODD - Java Interview Questions
PRIME AND EVEN AND ODD  how to write prime numbers?i want source code? how to write even numbers? i want source code? how to write odd numbers ?i want source code?  Hi Friend, 1)Following code displays the prime 

Java Beginners

Prime Numbers
Prime Numbers  Create a complete Java program that allows the user to enter a positive integer n, and which then creates and populates an int array with the first n prime numbers. Your program should then display the contents 

Java Beginners

plz help me - Java Beginners
plz help me  Hi, I want to search all field from database using name, and display in text box, then data is update and delete. i want to search name using alphabets a-z, plz reply fast. plz help me this is very urgent 

Java Beginners

plz Help me - Java Beginners
plz Help me  Hi, I want learn struts,I dont have any idea about this plz help how can i make a framework.If u have any information then plz send my personal id plz tell me that whose software installed.and give me brief 

Java Interview Questions

Write a java program to display the season given the month using switch case
Write a java program to display the season given the month using switch case  Write a java program to display the season given the month using switch case 

Java Beginners

plz help me - Java Beginners
plz help me  deepak hw can i create a data grid in jsp and also how can i connect to the data base plz help me  to create data grid in jsp use html tables with borders. to connect to data base use scriptlets. ex 

Java Interview Questions

write a java program for inserting a substring in to the given main string from a given position
write a java program for inserting a substring in to the given main string from a given position  write a java program for inserting a substring in to the given main string from a given position 

Java Beginners

Write a program that converts any given year to Roman Numeral in Java
Write a program that converts any given year to Roman Numeral in Java  Write a program that converts any given year to Roman Numeral 

Java Beginners

Java Problem - Java Beginners
Java Problem  Write a program 2 input a positive integer n and check wheter n is prime or not and also know the position of that number in the prime..., output should be ::: 11 is prime. It is at 5th position in the prime series 

Java Interview Questions

Plz give the answers - Java Interview Questions
Plz give the answers  1.Computing cos(x) using the cosine series: Recall that cos(x) is given by the following series: Write a program to compute...), is the number itself. Write a JAVA program to find all perfect numbers between 2 

Java Beginners

Java application PLZ ?
Java application PLZ ?  Write an application that demonstrates each of the following methods, based on the statement String dedicate = ?Dedicated to making your event a most memorable one:; indexOf(?D?) charAt(15) endsWith(one 

Java Beginners

How to write a session code - Java Beginners
How to write a session code   Once Again Thanks Deepak...Thanks for continuing responce I want using session in my project plz help me how to write a session code plz write a session code and post answer my personal id 

Programming Tutorials

Write a byte into byte buffer at given index.
Write a byte into byte buffer at given index.  In this tutorial, we will see how to write the given byte into byte buffer at the given ...;} } Output C:\>java PutAtIndex Write value 

Programming Tutorials

How to write the given byte into byte buffer.
How to write the given byte into byte buffer.  In this tutorial, we will see how to writes the byte into byte buffer by using  put(byte b.... abstract ByteBuffer put(byte b) The put(..) method write 

Java Beginners

Palindromic Prime Numbers
Palindromic Prime Numbers  Write a program that finds the first palindromic prime number above 100,000. Include the value of this prime in a comment at the start of the code 

Java Beginners

How to write a error.jsp code - Java Beginners
How to write a error.jsp code  Thanks once again I have a session code pls help me that how can i write a error.jsp page. why use error.jsp...let me know that hw can i write the error.jsp code. plz send me error.jsp code 

Java Beginners

write program - Java Beginners
write program  write a java program that will read the values...]); } System.out.println(); } } } For more information on java visit to : http://www.roseindia.net/java/beginners/ Thanks 

Programming Tutorials

Write a int value into int buffer at given index.
Write a int value into int buffer at given index.  In this tutorial, we will see how to write the given int value into int buffer at the given .... abstract  InttBuffer put(int index, int value) The put(..) method write 

Programming Tutorials

Write a float value into float buffer at given index.
Write a float value into float buffer at given index.  In this tutorial, we will see how to write the given float value into float buffer at the ...(..) method write the given float value into associated buffer at given index 

Java Beginners

Help me quickly plz??
Help me quickly plz??  Can you help me to write code quickly this code is a java code take input as double and should use command line arguments and enhanced for statement then find the combine of the numbers plz help quickly 

Programming Tutorials

Write a long value at given index into long buffer.
Write a long value at given index into long buffer.  In this tutorial, we will see how to write a long value at given index into long buffer... write the given long value into buffer at given index. abstract 

Java Beginners

write a program - Java Beginners
write a program  1. write a program that reads a string composed of 6 words then generate and print a word composed of the first letters of the 6 words.  Hi friend, Code to solve the problem : class FirstLetter 

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 

Java Beginners

swing program plz urgent sir - Java Beginners
swing program plz urgent sir   hi sir,i waan a jtable swings program table having column names "itemid","price".Initially table having single empty row.whenever we click the "enter" button automatically new row will be insert 

Java Beginners

How can i write a datagrid coding - Java Beginners
How can i write a datagrid coding  Hi, I want make a datagrid..plz send me datagrid coding using mysql database and jsp..plz tell me brief description about grid how can i connect datagrid with database. Thanks 

Java Beginners

Can u Look to the error plz - Java Beginners
Can u Look to the error plz  this is my code can u modify it plz and give me the result of it when u check it on eclipse or jcreator plz and i...;where is the answer sir.? just i want from you to look what is the error plz 

Java Interview Questions

help plz - Java Interview Questions
help plz  1 )write a program that does the following : a. prompts... 2)write a program that prompts the user to input a four-digit positive integer... , and the profit on each carton of milk is $0.27 . write aprogram that does the following 

Management

Plz Help Me
Plz Help Me  Write a program for traffic light tool to manage time giving between Main-Street and sub-Street. firstly, give green light for 40... traffic light on the frame. We have used java swing. It may help you. import 

Java Beginners

Plz help me with this Question - Java Beginners
Plz help me with this Question  this is java code ------------------------- Consider the following code: int [ ] a = [1, 2, 3]; Object o ="123... 2.2. Also explain how the code arrived at the results in b, bl, b2, and b3.   

Java Beginners

help again plz sorry - Java Beginners
help again plz sorry  Thanks for giving me thread code but i have a question this code is comletelly right and i want to make it runs much faster.... http://www.roseindia.net/java/thread/Java-Multithreading.shtml Thanks 

Java Interview Questions

plz help - Java Interview Questions
plz help  1)write a java program that prompts the user to input a decimal number and print the number rounded to the nearest integer? 2)write aprogram that prompts the user to input the five decimal numbers representing scors 

Java Beginners

Plz help with third Question - Java Beginners
Plz help with third Question  1)- Specify and implement a procedure that determines whether or not a string is a palindrome. (A palindrome reads the same backward and forward; an example is "deed 

Programming Tutorials

ShortBuffer in java, Write a short value into short buffer at given index.
Write a short value into short buffer at given index.  In this tutorial, we will see how to write the given short value into short buffer at the ...; ShortBuffer put(int index, short value) The put(..) method write the given 

Java Beginners

plz explain me the output of program - Java Beginners
plz explain me the output of program  Hi friends, can u please explain me the output of below program with proper explanation of each and every line. class ThisDemo { int a,b,c; void show(int a,int b,int c) { this.a 

Java Interview Questions

help plz - Java Interview Questions
help plz   1 )write a program that does the following : a. prompts... 2)write a program that prompts the user to input a four-digit positive integer... , and the profit on each carton of milk is $0.27 . write aprogram that does the following 

Java Beginners

Prime Numbers from range
Prime Numbers from range  how to find prime numbers in a given range which are palindromes??   Hi Friend, Try the following code: import java.util.*; public class PrimeAndPalindrome { static final int MAXNUMBER 

Java Beginners

how to write this program? - Java Beginners
how to write this program?  (game:scissor,rock ,paper) A program that plays the sciccor-rock-paper game.Revise the program to let the user continuously play until either the user or the computer wins more than 4 times 

Java Beginners

how to write the program - Java Beginners
how to write the program  WAP to create the report card user input Name, Class, Division, Roll no., Marks obtained in following subjects Lang Hindi History Geography Math Phy Chem. Bio Eve CSTA Also has a back up 

JavaMail Questions

sir i,have a another assignment for these question plz help me sir - JavaMail
. Write a multi-threaded Java program to print all numbers below 100,000... sir i,have a another assignment for these question plz help me sir  1. Design classes for Currency, Rupee, and Dollar. Write a program 

Java Beginners

Read Write
Read Write  Hi; How can I read certain line of say 10 text files and write to one text file   Java Read Multiple Files and store the data into another text file The given code reads all the text files of the directory 

Java Interview Questions

plz solve this program - Java Interview Questions
plz solve this program  write a program to out put this resault using two dimensional array this is an image of the reasult: http://www.4shared.com/file/154846107/dc2f1ac1/_2__Untitled-1.html so help me 

General

Prime Number in Java
Prime Number in Java       This Java programming tutorial will be read how to get prime number. First of all we will define a class "Prime Number". Java I/O package 

Java Beginners

Java converts any given year to Roman Numeral
Java converts any given year to Roman Numeral  Write a program that converts any given year to Roman Numeral 

Java Beginners

java programs - Java Beginners
java programs  1) write a program to print prime numbers? 2) write a program to print factorial of given number? 3)Please provide complete material of hibernate? 4) write a program to print ascii values and ascii numbers?  

Java Tips and Examples

Write a program to calculate factorial of any given number
Factorial Examples - Java Factorial Example to calculate factorial of any given number       This Java programming tutorial will teach you the methods for writing 

Java Beginners

multi-threaded Java program - Java Beginners
multi-threaded Java program  Write a multi-threaded Java program to print all numbers below 100,000 that are both prime and fibonacci number (some examples are 2, 3, 5, 13, etc.). Design a thread that generates prime numbers 

Java Beginners

plz help
plz help  what is the procedure and code to design an interactive GUI in java using swings 

Java Beginners

Plz Help
Plz Help  Hello Guys!! Plz. Help I need to write a program to display the astrological sign based on your birthday for example If we enter the date of birth in the following format from console--13/08/1990 it should give you 

Java Beginners

simple code - Java Beginners
simple code  to input a number and check wether it is prime or not and print its position in prime nuber series.  Hi friend, Code to help in solving the problem : import java.io.*; class PrimeNumber { public 

Java Beginners

java - Java Beginners
java  write a program in java to print first 10 prime number?  ... static void main(String args[] ){ int prime = 2; int count = 0; while(count < 10) { int k=0; for(int i = 2; i < prime ; i++){ if (prime%i == 0){ k=1 

Java Beginners

java - Java Beginners
java  Q 1- write a program in java to generate Armstrong numbers up to a specific limit? Q2- write a program in java to check a given number for Fibonacci term? Q3- write a program in java to generate prime number up 

Java Interview Questions

help today plz:( - Java Interview Questions
help today plz:(  write a program that promptes the user to enter the weight of a package in pounds, and then outputs the weight of the backage in to kilograms (one kilogram is approximately, 2.2 pounds)? but i don't use 

Java Interview Questions

help me plz - Java Interview Questions
help me plz  1)write a java program that prompts the user to input a decimal number and print the number rounded to the nearest integer? 2)write...? plz answer my question   Hi Friend, Try the following code: 1 

Java Beginners

Java Stream Write Exception
Java Stream Write Exception  I am doing socket programming. I have two files called Server.java and client.java. Both programs were running... as BROKEN PIPE. The contents of server.java which reads data1 is given below 

Java Beginners

plz help -java project very urgent
plz help -java project very urgent  ? Ford furniture is a local furniture store in acts, and they as CS graduate students to implement a software... are given four files: salesperson.txt id, name furniture.txt id, name, description 

Java Interview Questions

plz help me - Java Interview Questions
plz help me  1)Rewrite the method in exercise 10 such that it use.... -the middle peg may be used for temporarily holding disks. Write a method that takes... transfers. 3) write a method that takes an array and an integer value 

Java Interview Questions

Help Me With This Plz - Java Interview Questions
Help Me With This Plz  Write a program that's print a word like(I S E) on the black screen with 0,1 only by using two dimensional array? the 1's will represent the words 

Java Beginners

Clear Question plz et me know immediately - Java Beginners
Clear Question plz et me know immediately   Hi Deepak your application is good,pls modify this application and let me know My problem is that, Steps: 1:- A form have three 3 button delete,insert,edit. 2 

Java Beginners

how to write tis java programming - Java Beginners
; displays the details of facility how to write tis program in java.....pls reply...how to write tis java programming   Airport Transport Service.... Using Transport.class and Facility.class, write a program that displays 

Advertisements Advertisements
 

 

 

DMCA.com