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 does c in a circle mean?
Who developed c language and when?
What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
Why header files are used?
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
How can you return multiple values from a function?
Write a program to know whether the input number is an armstrong number.
What is the use of a ‘ ’ character?
What is #include called?
What are types of structure?
What is variable declaration and definition in c?
All technical questions
What is omp_num_threads?
How can I make it pause before closing the program output window?
What is the heap in c?