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
Is {a, n, d} a palindrome? If you are given a random string, is it a palindrome or not?
What is a "pure virtual" member function?
What are locale settings?
How do you override a variable in java?
Is stringwriter thread safe?
What are the advantages of packages in java?
Can we make main() thread as daemon?
What best practices should you follow while writing multithreaded code in java?
Can I learn java without any programming experience?
Is java free for businesses?
How do you differentiate abstract class from interface?
Can we extend private class in java?
Write a program to find the whether a number is an Armstrong number or not?
What is difference between static class and singleton pattern?
Explain the features of interfaces in java?