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...

write a program to fined second smallest and largest element
in a given series of elements (without sorting)

Answer Posted / raj

#include <stdio.h>


void main()
{
int i, ar[] ={15,22,122,15,6,12};
int a,b= 0,c,ta ,tb, tc;
a =ar[0];
b = ar[1];

for (i = 0; i < 6 ;i++)
{
if(a > ar[i])
{
b = a;
a = ar[i];
}
else if(b > ar[i])
{
b = ar[i];
}
}

printf("\n %d ",b);
}

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the properties of union. What is the size of a union variable

1186


to find the closest pair

2326


Is c call by value?

1014


How can this be legal c?

1084


Is multithreading possible in c?

1008


What is linear search?

1132


int i=10; printf("%d %d %d", i, i=20, i);

1618


Explain spaghetti programming?

1245


Can you define which header file to include at compile time?

1022


What are the 5 data types?

1127


Tell me the use of bit field in c language?

1065


Define Array of pointers.

1105


Define Spanning-Tree Protocol (STP)

1127


hi any body pls give me company name interview conduct "c" language only

2280


What does *p++ do? What does it point to?

1061