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 |
Hi, pls send the sample indian bank PO exam question papers and answers.
1.A SHOP KEEPER SELLS 10 TOFEES FOR A RUPEE, GAINING THEREBY 20%. HOW MANY DID HE BUY FOR A RUPEE? 2.IF 2A=3B=4C, THEN A:B:C IS/ 3.IF THE SELLING PRICE OF AN ARTICLE IS 4/3 TIMES OF ITS PRICE,THEN THE PROFIT PERCENTAGE IS/
9 Answers Mannar Company, TNPSC Tamil Nadu Public Service Commission,
The Longest River in the World____________
If the ticket sales s for a company increases 25% from standard sales to 60 tickets sold, then 60 - s =:
0, 7, 26, 63, 124, __
4 Answers Geometric Software, Godrej, Infosys,
3. (1/10)18 - (1/10)20 = ?
20) There are certain number of hats and gloves in a box. They are of 41 red, 23 green, 11 orange. Power gone. But a woman can differentiate between hats and gloves.How many draws are required to obtain a pair of each color.
Hometown
If a clock takes 7seconds to strike 7, how long will the same clock take to strike 10?
if a car starts from A towards B with some velocity due to some problem in the engine afetr travelling 30 km .if the car goes 4/5 th of its of actual velociteythe car reaches B 45 min later to the actual time.if the car engine fails after travelling 45km the car reaches the destination B 36min late to the actual time ,wat is the initial velocity of car and what is the distance between A and B on km.
three numbers are in the ratio 2:3:5 and the sum of their squares is 152, what will be their sum ?
The numbers A, B and C make a sum of 98. If the ratio A:B is 2:3 and that B:C is 5:8, the third number would be