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

How do you use a 'Local Block'?

1122


What is the purpose of 'register' keyword?

1051


What is the general form of #line preprocessor?

951


What is a char in c?

934


Describe explain how arrays can be passed to a user defined function

1042


How do you view the path?

1078


which is an algorithm for sorting in a growing Lexicographic order

1749


Why & is used in c?

1120


How can you find out how much memory is available?

1016


Why is c called a structured programming language?

1216


c program for searching a student details among 10 student details

2044


write a program to find out prime number using sieve case?

2040


Write a program to find factorial of a number using recursive function.

1069


What is wrong with this initialization?

958


What is void pointers in c?

960