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

What are disadvantages of java?

1000


What is e java?

1100


What is set and get methods in java?

977


What are the different types of constructor?

993


What does += mean coding?

933


What do you mean by exception handling in Java?

1292


Is it possible to instantiate the abstract class?

956


When we serialize an object does the serialization mechanism saves its references too?

1019


Why generics are used in java?

1041


What is the range of the short type?

1021


Difference between object instantiation and construction ?

1064


How to store image in arraylist in java?

973


Can a class be private?

960


What is concurrent hashmap and its features?

1090


What is static and final keyword in java?

1022