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 |
During a given week A programmer spends 1/4 of his time preparing flow chart, 3/8 of his time coding and the rest of the time in debugging the programs. If he works 48 hours during the week , how many hours did he spend debugging the program.
8 to the power of x is 32,what is the value of x?
Two trains are travelling at equilateral .Train A is travelling in the direction of earths spin.Other train B is travelling in opposite direction of earths spin.Which trains wheels will wear first?and why?
a number is terrific if it is a multiple of 2 or 3 ,how many terrific numbers are there between 11 and 11
if START = WALKA and BUDPI = XZFMR Then STUPID = ?
Find the missing number in this series? 8 2 14 6 11 ? 14 6 18 12
The solution of the differential equation cos x cos y dx + sin x sin y dy = 0 is
A question for all cricket lovers and friends. .!!How many runs a single player can score in One day match (50 overs/ 300 balls)...No 'no balls', no wides, no extras, no over throws...So how much runs he can score max???this quetion came in CSAT and 99% people answered it wrong..Clue: the answer is not 1800.
1@2=8,3@5=323,4@5=?
A positive integer which when added to 1000 gives a sum which is greater than 10.06 when it is multiplied by 100 this positive integer is __.
There are 6561 cricket balls out of them 1 is heavy. Find the minimum no. of times the cricket balls have to be weighed for finding out the heavy ball.
The following question asked at Infosys campus recruitment held at Pragathi. If 1>= y > x and xy=z.which of the following is not true? i)z>0 ii)x=z iii)y=z iv)z>y