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 / om prakash

#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
int ar[6]={21,23,14,65,2,35};
int min1=ar[0],min2=ar[0];
for(int i=1;i<6;i++)
{
if(min1<ar[i])
{
int min2=min1;
min1=ar[i];
}
}
print(min2);
getch();

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In simple interest what sum amounts of Rs.1120/- in 4 years and Rs.1200/- in 5 years.

1042


in a question ,last part has, the ages of two people has the ratio of 6:6 and by adding the numbers we get 44, after how many years the ratio would be 8:7?

842


What amount of compound interest can be obtained on an amount of Rs. 4500 at the rate of 4% p.a. at the end of 2 years?

826


An equilateral triangle of sides 3 inch each is given. How many equilateral triangles of side 1 inch can be formed from it?

936


Delhi's population is increasing day by day what is the reasong behind it & how can we solve it. G.D QUESTION (amit_nirwan@yahoo.com)

2288






If the data is for 10 bogies and for every 2 bogies added speed decreases by 5% what will be the speed after 5 hrs.

1173


if a man reduces the selling price of a fan from 400 to 380 his loss increases by 20% .cost price of fan is.

875


SEND + MORE = MONEY. Then what is the value of M + O + N + E + Y ?

1349


3/p=6, 3/q=15 ......find p-q

846


A moves 3 kms east from his starting point . He then travels 5 kms north. From that point he moves 8 kms east.How far is A from his starting point?

837


The minimum number of digits required to form every number which is greater than 900 and less than 9,000 is:

921


A string of alphanumeric is there. Find a string that starts with b and ends with 3 characters.

881


Find the next series: BC CE EG GK ?

981


A speedboat whose speed is 15 kmph in still water goes 30 kmph downstream and comes back in a total of 4hrs 30min. What is the speed of the stream in kmph?

771


How will u divide two numbers in a MACRO?

1344