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 second largest element in array w/o using sorting
techniques? use onle one for loop.

Answer Posted / ramesh

this is to largest element in an array using one loop concept:

for(int i=0;i<=arr.length;i++)
{
if(a[i]>a[i+1])//if first position element is large we want swap that element
{
t =a[i];
a[i] =a[i+1];
a[i+1]=t;
}
printf("%d",a[i+1]);

by
97894 33227

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What language is c written?

1055


What is the difference between text and binary modes?

1197


What are the different types of C instructions?

1318


How can I pad a string to a known length?

1036


Write a factorial program using C.

1084


What is use of integral promotions in c?

1150


How are structure passing and returning implemented?

1040


What is #include stdio h?

1122


How can I do graphics in c?

1035


With the help of using classes, write a program to add two numbers.

1043


What was noalias and what ever happened to it?

1048


What is the general form of #line preprocessor?

997


Dont ansi function prototypes render lint obsolete?

1135


Do string constants represent numerical values?

1396


Why does notstrcat(string, "!");Work?

1148