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
Differentiate between an external iterator and an internal iterator?
What is the meaning of c++?
How are the features of c++ different from c?
What is unary operator? List out the different operators involved in the unary operator.
What is const pointer and const reference?
How would you use the functions sin(), pow(), sqrt()?
Out of fgets() and gets() which function is safe to use and why?
What is a terminating character in c++?
What is array give example?
What is #include ctype h in c++?
What language is a dll written in?
Why is c++ so fast?
Which is best ide for c++?
What does the following code do: int c=0; cout< a) Undefined *Updated* b) 01 c) 00
Is c++ still being used?