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 |
From the below mentioned options choose the number that comes to 15 when divided by 4 and added by 9?
The three boxes 1,2,3 has values resp. AB,BC,AC Get 2A(B+C) +AC-2C(A-B)in Box 1 using only addition in 3 steps.
why we will appoint you.
The price of sugar increases by 20%, by what % should a housewife reduce the consumption of sugar so that expenditure on sugar can be same as before ?
A person runs 6 ft in 1/4 sec. how much it will run in 10 sec.
Which of the following appointments is not made by the President of India? a) Speaker of the LOk Sabha. b) Chief of Air Staff c) Chief of Army
a family has 4 people. father is 10kgs.mother 10 kgs.daughter 5 kgs,son 5 kgs........the family has to cross a river to reach other side of land ..Assume they should go from A to B....the boat is limited to carry 10 kgs at a time...how will they reach?THERE IS NO SAILOR TO TAKE THEM...
how can i get banking material online or any online banking previous papers please suggest me .
sir , i hv done 85 correct question in ssc cgl-tier-i 2010 after checking through my source which is correct , tell me whether i m eleigible for tier-ii or not charan , jalandhar
In 29 words or fewer, describe what you would strive to accomplish if you worked at Google Labs.
3 Answers Google, Patni, Wipro,
the ticket sales s for a company increases 25% from standard sales to 60 tickets sold, then 60 - s =:
in a railway station, there are tow trains going. One in the harbour line and one in the main line, each having a frequency of 10 minutes. the main line service starts at 5 o'clock. the harbour line starts at 5.02a.m. a man goes to the station every day to catch the first train. what is the probability of man catchinhg the first train