answersLogoWhite

0

public class PrimeNumberPrint {

/**

* @param args

*/

public static voidmain(String[] args) {

// TODO Auto-generated method stub

for(int i =2; i < 10; i++) {

System.out.println(i + " is prime is " + isPrime(i));

}

}

public static booleanisPrime(int n) {

int x = n;

for(int i=2; i

if(n%i == 0) {

return false;

}

}

return true;

}

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

Write a C program to print the following series 112 122 . 1n2?

write a program to print the series 1/12+1/22+.........+1/n2 ?


What BASIC program can compute and display all prime numbers from 1 to 40?

PRINT 2,3,5,7,11,13,17,19,23,29,31,37


Write a java program to print the result in the series?

If you have the series stored in an array, you loop through the array and print each array element in turn. Another possibility is to print out the numbers in the series as you generate them. In that case, you may not need to store anything (depending on the series, of course).


When you compile a program do you have to give a command to print the source program?

No. You can compile without printing the source. Indeed, I know of no compiler that would allow a program's source to be printed while it is being compiled. They are completely separate and unrelated tasks.


Program for print prime all number from 1 to 100 in foxpro?

Oh, what a lovely request! In FoxPro, you can create a program to print all prime numbers from 1 to 100 by using a loop to check each number for divisibility only by 1 and itself. If it meets this criteria, you can print it out on the screen. Remember, every number is unique and special, just like a happy little tree in a vast forest.


How do you find prime no in gwbasic program?

10 input "enter a no."; n 20 for i = 1 to n 30 if n mod i = 0 then c = c +1 40 next i 50 if c = 2 then print "prime number" else print "not a prime number" 60 end


Write a program to print first 100 alternative prime numbers?

This would require some computer knowledge. It can make it easier to find out the prime numbers without figuring it out in your head.


What is an example of non print source?

a NON print source is a source that is not printed, like electronic media. A website.


What is a sentence for print source?

If you need help with a printer just go to the print source.


Write a program in BASIC to find the sum of the series s equals 2 plus 4 plus . plus 100?

10 print "That is not a question." 20 print "That is a command." 30 end


Write a unix program to print print a pattern?

echo 'print a pattern'


What is happening in the print in source 2?

What is happening in the print in source is that various documents are being published.