write the program for prime numbers?
Answer Posted / jassneet anand
import java.*;
class prime
{
public static void main(String args[])
{
int number=__;//"you wish to check ";
int flag=0;
for(i=2;i<=(int)(Math.sqrt(number));i++)
{
if(number%i==0)
{
System.out.println("Not a Prime Number");
flag=1;
break;
}
}
if(flag==0)
System.out.println("Prime Number");
}
}
Is This Answer Correct ? | 12 Yes | 9 No |
Post New Answer View All Answers
Explain how can you be sure that a program follows the ansi c standard?
How can I read in an object file and jump to locations in it?
What is the size of enum in bytes?
How can I call a function with an argument list built up at run time?
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?
How can I recover the file name given an open stream?
Explain b+ tree?
Explain what are bus errors, memory faults, and core dumps?
Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.
What is the hardest programming language?
What is wild pointer in c with example?
What is the difference between struct and typedef struct in c?
c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above
How to implement a packet in C