Answer Posted / jaldeep
int sec_max(int a[])
{
if(a[0]>a[1])
{
max=a[0]
sec_max=a[1]
}
else
{
max=a[1]
sec_max=a[0]
}
for(i=1;i<n-1;i++)
{
if (a[i]>sec_max && a[i]< max)
{
sec_max=a[i];
}
else if(a[i]>max)
{
sec_max=max;
max=a[i];
}
return sec_max;
}
Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
What is unary operator? List out the different operators involved in the unary operator.
What can c++ be used for?
Where the memory to the static variables is allocated?
Explain the purpose of the keyword volatile.
What do the header files usually contains?
What is an incomplete type in c++?
Name the debugging methods that are used to solve problems?
Is map sorted c++?
Why do we need runtime polymorphism in c++?
Implement stack operations with pointers with appropriate exception checks.
What is an object in c++?
What is a local variable?
What are the main features of c++?
Why is c++ still popular?
What does it mean to declare a member function as static?