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 is structure padding and packing in c?

1067


What is the difference between far and near ?

1191


What is ambagious result in C? explain with an example.

2626


How can you call a function, given its name as a string?

1152


What is the stack in c?

1130


What do you mean by scope of a variable in c?

1010


What does a function declared as pascal do differently?

1124


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

1102


Can you please explain the difference between malloc() and calloc() function?

1120


Can you apply link and association interchangeably?

1123


What is a static function in c?

1162


a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list

998


Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?

1006


Should I learn data structures in c or python?

1017


Explain the concept and use of type void.

1112