ques-Input an array and prints the second minimum in an array??
Example
Input:34,45,21,12,54,67,15
Output:15
I want a solution in C/C++ language

Answer Posted / amit rawat

#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int ar[6]={21,23,14,65,2,35};
for(int i=0;i<6;i++)
{for(int j=0;j<i;j++)
{if(ar[i]<ar[j])
{int min=ar[i];
ar[i]=ar[j];
ar[j]=min;
}
}
}
cout<<"\n";
cout<<ar[1]<<"is the second lowest no";
getch();

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Light glows for every 13 seconds . How many times did it glow between 1:57:58 and 3:20:47 am.

1625


hello..i hav cleared SBI written exm..i am a post graduate in english..wht type of questions they may ask me at the interview? plz help.

1933


A gardener plants 100 meters towards east, next 100 meters towards north,next 100 meters towards west. 98 meters towards east, 96 meters towards north and 96 meters towards west, 94 meters towards south. and 94 meters towards east and so on. If a person walks between the trees what is the total distance travelled by him before he reaches the center.

825


If a person walks at 14 km/hr instead of 10 km/hr, he would have walked 20 km more. The actual distance travelled by him is?

942


Find the correct meaning of the following phrase: To be in the air

749






Samuel is obviously a bad fisherman. During the past season, in which he and the five members of his team spent four months on a boat together off Dutch Harbor, AK, he caught fewer fish than any of his teammates. Which of the following, if true, most weakens the argument above? While fishing this past season, Samuel fell sick for a week and did not catch any fish during this time. Before becoming a fisherman, Samuel piloted a fishing boat whose members regularly caught record numbers of fish. Unlike the other fishermen on his boat, at the order of the captain, Samuel fished this past season with experimental bait. Two seasons ago, Samuel fished on another boat off Dutch Harbor and caught more fish than any other member of that boat.

1891


there are 27 coins in which one is heavier than rest(all equal weight). how many measurements are needed to isolate that odd one.

772


if a=2, b=3, c=6 Find the value of c/(a+b)-(a+b)/c

727


There are 40 seats in a bus. People agree to share the money for the number of seats. The total money comes to 70.37. How many seats were free?

1381


i need icet model papers,po exam papers....please send urgent

1700


how can i improve myself in solving apptitude questions, guide and help me with some kind of tips.suggest me books too.so that i can get betterment in solving apps

2654


The difference between the compound and simple interest on a certain sum for 2 years at the rate of 8% per annum is Rs.80,What is the sum?

732


Albert and Fernandes have two leg swimming race. Both start from opposite ends of the pool. On the first leg, the boys pass each other at 18 m from the deep end of the pool. During the second leg they pass at 10 m from the shallow end of the pool. Both go at constant speed but one of them is faster. Each boy rests for 4 seconds at the end of the first leg. What is the length of the pool?

1035


with 4/5 full tank vehicle travels 12 miles, with 1/3 full tank how much distance travels

1077


Argentina had football team of 22 player of which captain is from Brazilian team and goalki from European team. For remainig player they have picked 6 from argentinan and 14 from european. Now for a team of 11 they must have goalki and captain so out of 9 now they plan to select 3 from argentinian and 6 from European. Find out no. of methods avilable for it

745