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

Where are c variables stored in memory?

1031


What is echo in c programming?

973


any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

1102


can we implement multi-threads in c.

1097


Explain goto?

1102


write a program to print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me...

1885


any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()

1089


Why is c called c?

973


Explain how can I write functions that take a variable number of arguments?

1045


What do you mean by dynamic memory allocation in c? What functions are used?

1122


What is register variable in c language?

995


What are the types of pointers?

1044


How do you view the path?

1087


What does nil mean in c?

1193


How can you avoid including a header more than once?

932