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
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / 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 ? | 2 Yes | 3 No |
16) There are two water tanks A and B, A is much smaller than B. While water fills at the rate of one litre every hour in A, it gets filled up like 10, 20, 40, 80, 160... in tank B. (At the end of first hour, B has 10 litres , second hour it has 20, and so on). If tank B is 1/32 filled after 21 hours, what is the total duration required to fill it completely? a) 26 hrs b) 25 hrs c) 5 hrs d) 27 hrs
6 Answers CTS, iSoft, TCS, Wipro, Yahoo,
City A's population is 68000, decreasing at a rate of 80 people per year. City B having population 42000 is increasing at a rate of 120 people per year. In how many years both the cities will have same population?
7 Answers 3i Infotech, Canara Bank, Geodesic, Hewitt, Mu Sigma,
A boy asked a girl her name she replied your name is behind your scooty Behind the scooty is written 7.3 3.3 9.3 2.3 What is her name? ?
A is twice efficient than B. A and B can both work together to complete a work in 7 days. Then find in how many days A alone can complete the work?
pls send me sbi previous solved papers through my email
if 2 miles of fence enclose a square plot of 160 acres,how large a square will 4 miles of fence
1027.05 ? 314.005 + 112.25 = ? (a) 825.395 (b) 825.095 (c) 825.305 (d) 825.295 (e) None of these
When two unbiased dice are tossed simultaneously, the numbers that appear on the top surface of the two dice are a and b.What is the probability that a^b is a perfect square? (a^b=a to the power of b)
Wat is the next letter OTTFFSS_?
If 9 examiners can examine a certain number of answer books in 12 days , working 5 hours a day ; for how many hours a day would four examiners have to work in order to examine twice the number of answer books in 30 days ?
From 7:00 AM to 11:00 AM it rained 2.25 inches. At 11:00 AM the rain increased to fall at a rate of 1.25 in. every two hours. How many inches of rain landed on the ground by 5:00 PM? a) 7 b) 9.75 c) 6 d) 3.25 e) 7.125 Also please provide the solution for this question .
In Madras, temperature at noon varies according to -t^2/2 + 8t + 3, where t is elapsed time. Find how much temperature more or less in 4pm to 9pm.