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 is the meaning of ?
What does emoji p mean?
What is the use of c language in real life?
Write a program to print factorial of given number using recursion?
How can I swap two values without using a temporary?
How reliable are floating-point comparisons?
Which is better pointer or array?
What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.
What is a char in c?
Why is c known as a mother language?
Write a progarm to find the length of string using switch case?
What is a good data structure to use for storing lines of text?
What is console in c language?
What are the 5 types of inheritance in c ++?
What is the use of getchar() function?