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

A boy asks the relation of two people walking along the street. One of them says that the lady walking with him is the daughter of his mother's only son. What is the relation between the two people?

682


A Flight takes off at 2 A.M from northeast direction and travels for 11 hours to reach the destination which is in north west direction.Given the latitude and longitude of source and destination. Find the local time of destination when the flight reaches there?

988


A man runs towards the east direction and then takes his right. Then he takes a left and again 50 degrees to his right. What is the direction in which he is moving now?

704


Current/most recent employer (Please state full names and address including Country and post code) Current Position Held When would you be available to start work? ONLINE INTERVIEW [INSTRUCTIONS: Give brief answers to all the under listed questions] QUESTIONS ANSWER SPACE 1) What are your years of experience? 2) How do you approach a technical problem? Give an example. How long do you think it would be before you will make a significant contribution to the team/company?

809


Find the hypotaneous of a right angle isosceles triangle whose area is 50.

859






Why do you want to join gnfc

2234


If A=Z, B=Y, C=X, .......... Z=A, Then GROUP = ?

665


If INDIA = JOEJB then BSNZ =?

941


If a refrigerator contains 12 cans such that 7 blue cans and 5 red cans. In how many ways can we remove 8 cans so that atleast 1 blue can and 1 red can remains in the refrigerator?

1776


there are 76 persons. 53 can read hindu,46 can read times,39 can read deccan and 15 can read all.if 22 can read hindu and deccan and 23 can read deccan and times then what is the number of persons who read only times and hindu………

921


2, 3, 6, 7--- using these numbers form the possible four digit numbers that are divisible by 4.

727


epaulet : shoulder : : ring :?

1143


Sunny ate 100 apples in five days, each day eating 6 more than the previous day. How many apples did he eat on the first day?

722


A certain quantity of milk is found to be adulterated to the extent of 10%. What proportion of the adulterated milk should be replaced with pure milk to take the purity level to 98%?

1000


work can be done by 8 men and 10 women in 25 days, the same work can be done by 10 children and 5 women . in how many days 2 children and 3 men

717