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 / anamika datta

#include<stdio.h>
#include<conio.h>
void main()
{
int n[]={5,3,4};
int i,large,sec_large;
clrscr();

large=sec_large=n[0];
for(i=0;i<3;i++)
{
if(n[i]>large)
{
sec_large=large;
large=n[i];
}

}
printf("%d",sec_large);
}
getch();

Is This Answer Correct ?    10 Yes 19 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are enums in c?

1214


What is meant by 'bit masking'?

1397


What is indirection?

1108


why wipro wase

2321


how to build a exercise findig min number of e heap with list imlemented?

2078


What does volatile do?

988


What is meant by high-order and low-order bytes?

1051


Why is this loop always executing once?

1067


how to introdu5ce my self in serco

2011


What are different storage class specifiers in c?

1101


What do you understand by normalization of pointers?

1068


What is the purpose of sprintf?

1144


What is a scope resolution operator in c?

1286


Why do we use namespace feature?

1065


Are the variables argc and argv are local to main?

1324