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

How to find remainder of two numbers without using (%) operator

1 Answers  


A queen had 3 rings in a jewel box. She had 3 daughter's and one day the king said that the queen should give one ring to each of her daughter's and she should also keep a ring in that jewel box . The queen did what the king said. How is this possible ?

3 Answers  


how many types of indexing?

2 Answers  


13_46_8_180_210_75 = 64 . Use + and – in the empty places to make the equation holds good. Take m = number of + and n = number of – . Find m – n?

0 Answers   Infosys,


A+B+C+D=D+E+F+G=G+H+I=17 where each letter represent a number from1 to 9. Find out what does letter D and G represent if letter A=4.

8 Answers   Accenture, Cognizant, Elico, TCS,


The IT giant Tirnop has recently crossed a head count of 150000 and earnings of $7 billion. As one of the forerunners in the technology front, Tirnop continues to lead the way in products and services in India. At Tirnop, all programmers are equal in every respect. They receive identical salaries ans also write code at the same rate.Suppose 12 such programmers take 12 minutes to write 12 lines of code in total. How many lines of code can be written by 72 programmers in 72 minutes?

12 Answers   TCS,


Each row of letters or numbers has a rule connecting them. Write the next number or letterin the brackets. K , A , J , B , I , C , H , (_ _ _)

0 Answers   Accenture,


A sales person multiplied a number and get the answer is 3, instead of that number divided by 3. What is th answer he actually has to get? 1/3

0 Answers   TCS,


If y/x = 1/3 and x + 2y = 10, then x is

8 Answers   Paladon,


If in a certain code 'RANGE' is coded as 12345 and 'RANDOM' is coded as 123678, then the code for the word 'MANGO' would be

12 Answers   Cli3l, Infosys, Wipro,


Low temperature at the night in a city is 1/3 more than 1/2 hinge as higher temperature in a day. Sum of the low temp and highest temp is 100c. Then what is the low temperature

0 Answers   TCS,


fridge cost R Rs,cover value is 5,discount d% then its new cost

3 Answers   Wipro,


Categories