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
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.
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.
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
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.");
}
}
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
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
prime numbermahesh April 29, 2012 at 10:32 PM
veri nice
core java and advance javaJ.ravi kumar June 2, 2012 at 8:14 PM
excellent work
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