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

The mean of 100 bags was found to be 30. What will be the correct mean if at the time of calculation two bags were wrongly taken as 32 and 12 instead of 23 and 11?

0 Answers   Cap Gemini,


A farmer has a farm square of 100 sq.m a cow is tied at one and with a rope of 10m length.assume pi-3.what is the area of land the cow can graze.

0 Answers   Caritor Solutions,


Ramesh owns 2/3 of the travel business and sells 3/4 of his shares for Rs. 75000. What is the value of his travel business?

0 Answers   Cap Gemini,


Ms. Anurag Awasthi deposits an amount of Rs. 56500 to obtain a simple interest at the rats of 12% p.a. for 3 years. What total amount will Mr. Anurag Awasthi get at the end of 3 year?

0 Answers   Axis Bank,


In a certain department store, which has four sizes of a specific shirt, there are 1/3 as many small shirts as medium shirts, and 1/2 as many large shirts as small shirts. If there are as many x-large shirts as large shirts, what percent of the shirts in the store are medium?

5 Answers  


Ravi's salary was reduced by 25%.Percentage increase to be effected to bring the salary to the original level is

0 Answers   Wipro,


2/3 of people read newspaper A,3/4 read newspaper B.if 38 read both and 8 didn't read any of the 2.how many read A?

0 Answers   Accenture,


modulo(373,7)+round(5.8)+truncat(7.2)-round(3.4) = ? i exactly don't remember the truncate function.but the function was where we skip the '.' part.

0 Answers   Accenture,


The length, width and height of a room is 3,2,1 respectively. The length of the room is doubled and height and width is halved .then percentage decrease in area of wall. is........... a) 13.6% b) 27.2% c) 10% d) none of these

1 Answers   ITC Infotech, TCS,


Two trains 100 meters and 120 meters long are running in the same directions with speed of 72 km/hr and 54 km./hr. in how much time will the first train cross the second?

0 Answers   Axis Bank,


There are two trees in a lawn. One grows at a rate 3/5 of the other in 4 years. If the total growth of trees What is the height of the smaller tree after 2 years

0 Answers   TCS,


A monkey climbs a 52 – m smooth pole. It climbs 6 m up in one minute and slips 2 m down in every alternate minute. How long will it take to reach the top of the pole?

16 Answers  


Categories