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

Hi, pls send the sample indian bank PO exam question papers and answers.

0 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____________

11 Answers  


If the ticket sales s for a company increases 25% from standard sales to 60 tickets sold, then 60 - s =:

2 Answers   Accenture, Valtech,


0, 7, 26, 63, 124, __

4 Answers   Geometric Software, Godrej, Infosys,


3. (1/10)18 - (1/10)20 = ?

1 Answers  


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.

7 Answers   TCS,


Hometown

1 Answers  


If a clock takes 7seconds to strike 7, how long will the same clock take to strike 10?

0 Answers   Infosys,


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.

3 Answers   IBM, Oracle, TCS,


three numbers are in the ratio 2:3:5 and the sum of their squares is 152, what will be their sum ?

5 Answers   Banking,


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

0 Answers   CGI,


Categories