Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Is {a, n, d} a palindrome? If you are given a random string, is it a palindrome or not?

1109


What is a "pure virtual" member function?

1077


What are locale settings?

969


How do you override a variable in java?

1111


Is stringwriter thread safe?

977


What are the advantages of packages in java?

1551


Can we make main() thread as daemon?

1084


What best practices should you follow while writing multithreaded code in java?

1035


Can I learn java without any programming experience?

1025


Is java free for businesses?

1057


How do you differentiate abstract class from interface?

945


Can we extend private class in java?

967


Write a program to find the whether a number is an Armstrong number or not?

1003


What is difference between static class and singleton pattern?

1008


Explain the features of interfaces in java?

960