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
What are the types of type qualifiers in c?
Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?
What does node * mean?
What is a null string in c?
explain what is fifo?
What is main () in c?
Tell me the use of bit field in c language?
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
What is a void pointer in c?
What are pointers? What are different types of pointers?
What is new line escape sequence?
Tell me about low level programming languages.
What is variables in c?
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
Why do we use c for the speed of light?