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
What are pointers? What are different types of pointers?
How can I manipulate strings of multibyte characters?
How many bytes are occupied by near, far and huge pointers (dos)?
All technical questions
What is the meaning of 2d in c?
Do pointers take up memory?
Why we use int main and void main?
What are the different types of errors?
Can a void pointer point to a function?
Explain what is operator promotion?
Why void main is used in c?
What is the difference between declaring a variable by constant keyword and #define ing that variable?
What is difference between array and pointer in c?
What is the purpose of type declarations?
What is sorting in c plus plus?