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...

Find the second maximum in an array?

Answer Posted / navs

if we take the array as
arr[]={1,4,7,2,10,0,6}

get the count

int count =6;
int max =arr[0];
int smax;

for (i=0;i<=count;i++)
{
if(max<arr[i])
{
smax=max;
max=max[i];
}
}

smax would give the second largest number

Is This Answer Correct ?    0 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Mention the storage classes in c++.

1028


What is function overriding in c++?

1022


What is the difference between a declaration and a definition?

1044


What are arithmetic operators?

942


Can you please explain the difference between overloading and overriding?

1028


What is a catch statement?

987


What is enum c++?

1151


What do you mean by enumerated data type?

1004


When is dynamic checking necessary?

1045


What is a constant? Explain with an example.

954


Discuss the effects occur, after an exception thrown by a member function is unspecified by an exception specification?

1019


Explain stack & heap objects?

995


What is private public protected in c++?

983


What is overloading unary operator?

1028


How a modifier is similar to mutator?

1113