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

15 lit of water containing 20 % of alcohol ,then added 5 lit of water .What is the % of alcohol?

0 Answers   CMC,


If a man stands in front of sun what is the first letter of the direction which is left to him ?

4 Answers   Geometric Software,


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  


if the word 'ddosszm' is changed to 'central' then what will be the change for 'rtjbl' ?

0 Answers   Accenture,


Justify the year gaps betweeen your studies?

0 Answers   State Bank Of India SBI,


Q) A new apartment complex purchased 60 toilets and 20 shower heads. If the price of a toilet is three times the price of a shower head, what percent of the total cost was the cost of all the shower heads? a) 9% b) 10% c) 11% d) 13% e) 15%

3 Answers  


There are 4 married couples out of which 3 a group is needed . But thier should not be his of her spouse .How many groups are possible ?

0 Answers   Infosys,


Out of 10 white, 9 black and 7 red balls, in how many ways can we select one or more balls please with solution.

8 Answers   Wipro,


X is 3 years younger to Y. X's father is a businessman who invested 10000/- at 8% rate of interest n obtained his amount after 10 years. Y's father is a job holder who invested around 20000 at 2% rate n obtained his amount after 20 years.Now Compunded both of dem get around ABC rs/- (dnt remenbr). After 5 years the ratio of ages of X n Y is 1:2. Now X's father is 20 years older to Y n Y' father is 30 years more than X. After 20 years again. X's mother asks X's father to purchase a LCD TV which costs around 45000/-. what is the age of X n Y together

2 Answers   TCS,


2 vessels A and B contain spirit and water in the ratio of 5:2 and 7:6 respectively .find the ratio in which these mixtures be mixed 2 obtain a new mixture in the vessel containg spirit and water in the ratio 8:5

6 Answers  


If a worker gets late for his work he has to pay a fine of Rs 200 on the first day and the fine increases by 25 Rs per day. If he pays a total amount of Rs 9450, for how many days did he pay for?

0 Answers   CGI,


distance D=rt where r & t are +ve and r is constant,as t increses then D_________

10 Answers   Wipro,


Categories