Answer Posted / fish
int a1(int[] a)
{
int max1 = -1;
int max2 = -1;
for (int i=0; i<a.length; i++)
{
if (a[i] > max1)
{
max2 = max1;
max1 = a[i];
}
else if (a[i] != max1 && a[i] > max2)
max2 = a[i];
}
return max2;
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
When is dynamic checking necessary?
Why c++ is called oop?
What is purpose of new operator?
What is the size of integer variable?
write a programme to get a character and thier ASCII value
What is c++ vb?
What is the difference between passing by reference and passing a reference?
What is atoi?
What is #include iomanip?
What is a singleton c++?
What is difference between rand () and srand ()?
What is buffering in c++?
What operator is used to access a struct through a pointer a) >> b) -> c) *
What is the most useful programming language?
Why c++ does not have finally?