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 is floating point constants?

1120


in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above

1050


Which node is more powerful and can handle local information processing or graphics processing?

1315


What is the difference between the = symbol and == symbol?

1109


What is pass by reference in c?

1186


Is there sort function in c?

1011


Write a program to print “hello world” without using semicolon?

1119


Why is c so important?

1060


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

1010


Explain a file operation in C with an example.

1118


what do you mean by inline function in C?

1051


What are type modifiers in c?

1046


What are data types in c language?

1054


What is the default value of local and global variables in c?

1038


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

2074