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
Explain public, protected, private in c++?
What is searching?
Should you pass exceptions by value or by reference?
Write a Program for dynamically intialize a 2 dimentional array. Eg:5x20, accept strings and check for vowels and display the no.finally free the space allocated .
What are protected members in c++?
When must you use a pointer rather than a reference?
What is a c++ vector?
What is basic if statement syntax?
What is the benefit of c++?
What is ios flag in c++?
Write a program to find the Fibonacci series recursively.
Should the this pointer can be used in the constructor?
Why is c++ difficult?
Describe linked list using C++ with an example.
What are activex and ole?