1.find the second maximum in an array?
2.how do you create hash table in c?
3.what is hash collision

Answer Posted / jaypal rajput

//find second maximum number in given array.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a[5];
int max=0,secmax=0,i;
cout<<"Enter element";
for(i=0;i<=4;i++)
{
cin>>a[i];
}
for(i=0;i<=4;i++)
{
if(a[i]>max)
{
secmax=max;
max=a[i];
}
if(a[i]>secmax&&a[i]<max)
{
secmax=a[i];
}
}
cout<<"The max element is="<<max;
cout<<"the sec max is="<<secmax;
getch();
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.

1617


What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?

927


Are pointers integer?

543


Is the exit() function same as the return statement? Explain.

656


What does *p++ do?

577






Explain what is a const pointer?

632


What are the parts of c program?

627


in iso what are the common technological language?

1627


What are the uses of a pointer?

675


Why c is called object oriented language?

576


What is the scope of an external variable in c?

563


What is openmp in c?

607


Write the Program to reverse a string using pointers.

613


praagnovation

1774


Explain what is a stream?

606