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

A man has Rs 2. He wins or loses Re 1 at a time. If he wins he gets Re 1 and if he loses the game he loses Re 1. He can loose only 5 times. He is out of the game if he earns Rs 5.Find the number of ways in which this is possible?

0 Answers   3i Infotech,


The lowest temperature in the night in a city A is 1/3 more than 1/2 the highest during the day. Sum of the lowest temperature and the highest temperature is 100 degrees. Then what is the low temp?

0 Answers   Accenture,


A man covers 27 kms in 9 hrs and return home with a speed of 5 km/hr.what is his average speed for entire journey?

5 Answers  


7 students can complete a task of making 9 scientific models in 21 days. How many students can make 3 models in 14 days.

0 Answers   NTS,


tickets numbered 1 to 20 are mixed up and then a ticket is drawn at random. What is the probability that the ticket drawn has a number which is a multiple of 3 or 5?

0 Answers  


inept : clever :: languid :

0 Answers   IBM,


A person starts walking at a speed of 5km/hr through half the distance, rest of the distance he covers with a speed 4km/hr. Total time of travel is 9 hours. What is the maximum distance he can cover?

0 Answers   Hexaware,


Convert the decimal number 310 to the base 6.

0 Answers   TCS,


in a 100m race , A beats B by 15m and B beats C by 10m . If A beats C by 5 sec then find the speed of C.

4 Answers   Infosys, TCS,


There is a safe with a 5 digit number as the key. The 4th digit is 4 greater than second digit, while 3rd digit is 3 less than 2nd digit. The 1st digit is thrice the last digit. There are 3 pairs whose sum is 11. Find the number.

0 Answers   Infosys,


please give me model Question papers for bank recruitment exams please send it to my mail address shubhangijain5@gmail.com

0 Answers  


1. There is a toy train that can make 10 musical sounds. It makes 2 musical sounds after being defective. What is the probability that me musical sound would be produced 5 times consecutively

4 Answers   TCS,


Categories