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 / k.shravan

main()
{

int a[10],min,max,temp,i;
clrscr();
printf("\n\n Enter the array=>");
for(i=0;i<5;i++)
scanf("%d",&a[i]);
min=max=a[0];

for(i=1;i<5;i++)
{
if(a[i]>max)
{
min=max;
max=a[i];
}

if(a[i]<max && a[i]>min)
{
min=a[i];
}

}
printf("%d---%d",max,min);

getch();
}

Is This Answer Correct ?    7 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantage of c language?

1060


What is string function in c?

994


Which header file should you include if you are to develop a function which can accept variable number of arguments?

1411


a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f

2161


What happens if a header file is included twice?

1047


The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none

1260


Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]

1096


How are variables declared in c?

1110


What is the explanation for modular programming?

1222


How is actual parameter different from the formal parameter?

1028


Why isnt any of this standardized in c?

1091


Why functions are used in c?

1147


Explain bit masking in c?

1145


What is c standard library?

1222


All technical questions

1998