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 / ramesh

this is to largest element in an array using one loop concept:

for(int i=0;i<=arr.length;i++)
{
if(a[i]>a[i+1])//if first position element is large we want swap that element
{
t =a[i];
a[i] =a[i+1];
a[i+1]=t;
}
printf("%d",a[i+1]);

by
97894 33227

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how could explain about job profile

1916


How are pointers declared in c?

1057


What is sizeof in c?

1002


Why is c used in embedded systems?

1114


What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file

1108


How can you tell whether a program was compiled using c versus c++?

1102


What is signed and unsigned?

1056


Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result

1900


.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }

1292


c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above

1254


the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters

2296


What is the use of gets and puts?

1026


Is javascript written in c?

1062


For what purpose null pointer used?

1068


Process by which one bit pattern in to another by bit wise operation is?

1156