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
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 |
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 |
How to find remainder of two numbers without using (%) operator
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 ?
how many types of indexing?
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?
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?
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 , (_ _ _)
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
If y/x = 1/3 and x + 2y = 10, then x is
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
fridge cost R Rs,cover value is 5,discount d% then its new cost