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
Explain the different access specifiers for the class member in c++.
What are the advantages of c++? Explain
Are c and c++ different?
How does list r; differs from list r();?
How many types of comments are there in c++?
Can I run c program in turbo c++?
What is a friend function in c++?
What is the purpose of templates in c++?
Which is best ide for c++?
What is set in c++?
What is object oriented programming (oop)?
Explain stack & heap objects?
Difference between Abstraction and encapsulation in C++?
What is the difference between global variables and static varables?
Name four predefined macros.