Write a program that read 2o numbers in and array and
output the second largest number. Can anybody help??
Answer Posted / sujeet pardeshi
int k;
for(i=0;i<2;i++)
{
max=0;
for(j=n;j>=i;j--)
{
if(a[j]>max)
{
max=a[j];
k=j;
}
}
swap(a[i],a[k]);
}
printf("2nd highest no is:%d",max);
Is This Answer Correct ? | 3 Yes | 3 No |
Post New Answer View All Answers
What is a syntax in c++?
Explain what you mean by a pointer.
What are the four main data types?
Can we specify variable field width in a scanf() format string? If possible how?
Can you explicitly call a destructor on a local variable?
What is DlgProc?
What is a manipulator in c++?
What is & in c++ function?
How do you decide which integer type to use?
What is the operator in c++?
Is turbo c++ free?
True or false, if you keep incrementing a variable, it will become negative a) True b) False c) It depends
What is == in programming?
What is the use of structure in c++?
What are the syntactic rules to be avoid ambiguity in multiple inheritance?