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 |
"what category of job are you looking for and why"asked from an mep engineer.
0 Answers Grocon Construction Australia,
what is your approach to working under pressure?
In a triangle, the average of the two angles is 56 degrees where as their difference is 24 degrees. What is the measurement of the biggest angle of the triangle?
What annual payment will discharge a debt of rs. 6,450 Due in 4 years at 5% per annum simple interest?
Four Members A, B, C, D are playing a game .A person losing a game should double the amount of others .B, C, D are losing in order after three games .The amount after 3 games are A&B having 40,D is having 16&C 80.What amount did B have?
please send me sbi question papers....any one help me out...
1 Answers State Bank Of India SBI,
In a single throw of two dice, find the probability of getting a total of 9 or 11
A man has house old expenses 50% And 20& for transport & 15& other expenses & 240 for recreation what will his budgeted salary pla reply interview on 22 Aug 2011
The Parallelogram PQRS, the line RS have midpoint T from line PQ. What is the ratio of Triangle PTS / parallelogram PQRS?
A person's salary is getting reduced by 20%. What percentage should be added to get back his original salary?
What are applications of half adder circuit?
Name of the cipla medicine product