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

Which programming language is best in future?

966


What is Major and importance difference between for and foreach loop ?

1154


What is abstraction in java?

1096


What are data types in oop?

1037


What is udp in java?

982


Give any two differences between C++ and java.

1150


Compare overloading and overriding?

1006


Explain what access modifiers can be used for variables?

1062


Is java based on c?

997


What is entry set in java?

1148


What will happen if non-synchronized method calls a static synchronized method and what kind of lock it acquires?

1114


Explain static nested classes ?

1122


How variables are declared?

983


Why is boolean important?

1069


Name few java 8 annotations ?

1031