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

"what category of job are you looking for and why"asked from an mep engineer.

0 Answers   Grocon Construction Australia,


what is your approach to working under pressure?

8 Answers  


In a triangle, the average of the two angles is 56 degrees where as their difference is 24 degrees. What is the measurement of the biggest angle of the triangle?

0 Answers   CGI,


What annual payment will discharge a debt of rs. 6,450 Due in 4 years at 5% per annum simple interest?

0 Answers  


Four Members A, B, C, D are playing a game .A person losing a game should double the amount of others .B, C, D are losing in order after three games .The amount after 3 games are A&B having 40,D is having 16&C 80.What amount did B have?

0 Answers   Accenture,


please send me sbi question papers....any one help me out...

1 Answers   State Bank Of India SBI,


In a single throw of two dice, find the probability of getting a total of 9 or 11

4 Answers  


A man has house old expenses 50% And 20& for transport & 15& other expenses & 240 for recreation what will his budgeted salary pla reply interview on 22 Aug 2011

2 Answers  


The Parallelogram PQRS, the line RS have midpoint T from line PQ. What is the ratio of Triangle PTS / parallelogram PQRS?

0 Answers   Cap Gemini,


A person's salary is getting reduced by 20%. What percentage should be added to get back his original salary?

2 Answers   Hexaware,


What are applications of half adder circuit?

2 Answers   GGH, TCS, Wipro,


Name of the cipla medicine product

0 Answers   C DAC,


Categories