Program to find greatest prime number in n numbers?
Answer Posted / rajani nagandla
1.Read n
2.lets take variables of type int (i=1,j=1,temp=0,count=0);
3. for (;i<n;i++){
count=0;
while(j<=i){
if((i%j)==0){
count+=1;
j++;
if(count>2)break;
}
}
if(count==2)
temp=i;
}
4.the value in temp after for loop execution will be the
Greatest Prime Number
| Is This Answer Correct ? | 6 Yes | 5 No |
Post New Answer View All Answers
What are disadvantages of java?
What is e java?
What is set and get methods in java?
What are the different types of constructor?
What does += mean coding?
What do you mean by exception handling in Java?
Is it possible to instantiate the abstract class?
When we serialize an object does the serialization mechanism saves its references too?
Why generics are used in java?
What is the range of the short type?
Difference between object instantiation and construction ?
How to store image in arraylist in java?
Can a class be private?
What is concurrent hashmap and its features?
What is static and final keyword in java?