Answer Posted / rw-rwx
This might help.
max1=a[0];max2=a[1];
for(i=1;i<n;i++)
{
if(max1<a[i])
{
max2=max1;
max1=a[i];
}
if(max2==max1) max2=a[i+1];
if(max2==a[n]) { printf("All numbers are the same no second max.\n"); return 0;}
if(max2<a[i] && max1!=a[i]) max2=a[i];
}
Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is prototype for that c string function?
What is private, public and protected inheritance?
What is a string example?
What is the c++ code?
what kind of projects are suitable for c and c++
Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3) || (x == 5)) y++; else if (x == 2) y *= 2; else if (x == ) y-= 7; else y = 8; if the value of x is 4 before the nested IFs are executed, what is the value of y after the nested IFs are executed?
How do you sort a sort function in c++ to sort in descending order?
Is c the same as c++?
Explain linked list using c++ with an example?
Can you pass an array to a function in c++?
Explain the isa and hasa class relationships.
What is an accessor in c++?
What do you know about near, far and huge pointer?
Why is c++ awesome?
What doescout<<(0==0) print out a) 0 b) 1 c) Compiler error: Lvalue required