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

During a given week A programmer spends 1/4 of his time preparing flow chart, 3/8 of his time coding and the rest of the time in debugging the programs. If he works 48 hours during the week , how many hours did he spend debugging the program.

0 Answers  


8 to the power of x is 32,what is the value of x?

0 Answers   Accenture,


Two trains are travelling at equilateral .Train A is travelling in the direction of earths spin.Other train B is travelling in opposite direction of earths spin.Which trains wheels will wear first?and why?

0 Answers  


a number is terrific if it is a multiple of 2 or 3 ,how many terrific numbers are there between 11 and 11

4 Answers  


if START = WALKA and BUDPI = XZFMR Then STUPID = ?

0 Answers   Baan Infotech,


Find the missing number in this series? 8 2 14 6 11 ? 14 6 18 12

0 Answers   3i Infotech,


The solution of the differential equation cos x cos y dx + sin x sin y dy = 0 is

3 Answers   RRB,


A question for all cricket lovers and friends. .!!How many runs a single player can score in One day match (50 overs/ 300 balls)...No 'no balls', no wides, no extras, no over throws...So how much runs he can score max???this quetion came in CSAT and 99% people answered it wrong..Clue: the answer is not 1800.

7 Answers   Apex,


1@2=8,3@5=323,4@5=?

1 Answers  


A positive integer which when added to 1000 gives a sum which is greater than 10.06 when it is multiplied by 100 this positive integer is __.

0 Answers  


There are 6561 cricket balls out of them 1 is heavy. Find the minimum no. of times the cricket balls have to be weighed for finding out the heavy ball.

0 Answers   Cap Gemini,


The following question asked at Infosys campus recruitment held at Pragathi. If 1>= y > x and xy=z.which of the following is not true? i)z>0 ii)x=z iii)y=z iv)z>y

3 Answers   Infosys, Wipro,


Categories