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
Is c++ fully object oriented?
What is data abstraction? How is it different from data encapsulation?
What is an accessor in c++?
Can I learn c++ as my first language?
Write is a binary search tree? Write an algo and tell complexity?
What is a manipulative person?
What are the five basic elements of a c++ program?
Differentiate between an external iterator and an internal iterator? What is the advantage of an external iterator.
Explain the uses of static class data?
What is a hashmap c++?
What is the use of "new" operator?
What is the main function c++?
Is c++ free?
If a function doesn’t return a value, how do you declare the function?
what is software cycle? What is a mission critical system ? What is the important aspect of a real-time system ? Explain the difference between microkernel and macro kernel. Give an example of microkernel.Why paging is used ? Which is the best page replacement algo and Why ? What is software life cycle ? How much time is spent usually in each phases and why Which one do U want to work if selected in Honeywell ? Which are the different types of testing ? What is a distributed system ? Some questions about CSP. Which languages do U know ? What are the differences between Pascal and C. questions from Compiler construction and Lisp. Which are the different computer architecture? What is the requirement in MIMD ? What is the difference between RISC and CISC processors ? Difference between loosely coupled and tightly coupled systems ? What is an open system?