Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



ques-Input an array and prints the second minimum in an array?? Example Input:34,45,21,12,54,67,15..

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

ques-Input an array and prints the second minimum in an array?? Example Input:34,45,21,12,54,67,15..

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

Post New Answer

More General Aptitude Interview Questions

From the below mentioned options choose the number that comes to 15 when divided by 4 and added by 9?

0 Answers   Aricent,


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.

5 Answers   Godrej,


why we will appoint you.

0 Answers  


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 ?

0 Answers   Mu Sigma,


A person runs 6 ft in 1/4 sec. how much it will run in 10 sec.

0 Answers   Accenture,


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

3 Answers   Sodexo,


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...

2 Answers   Manhattan,


how can i get banking material online or any online banking previous papers please suggest me .

1 Answers  


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

0 Answers  


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 =:

0 Answers   TCS,


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

0 Answers   InfoTest,


Categories