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
program explaining feautures of c++
How can virtual functions in c++ be implemented?
Is c++ still in demand?
what is data abstraction in C++?
What is size of string in c++?
what is c++
What are the sizes and ranges of the basic c++ data types?
What is meant by forward referencing and when should it be used?
How many characters are recognized by ANSI C++?
What do you mean by translation unit?
Differentiate between declaration and definition.
What is the sequence of destruction of local objects?
What does std mean in c++?
What are c++ variables?
State two differences between C and C++.