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
How do you construct an increment statement or decrement statement in C?
What are the uses of a pointer?
What is typedf?
Explain 'bus error'?
What is the use of in c?
What should malloc() do?
What are the different data types in C?
What are the 4 types of functions?
What are the 5 organizational structures?
Why is c not oop?
Explain why C language is procedural?
what is the role you expect in software industry?
Explain how can I manipulate strings of multibyte characters?
What is const volatile variable in c?
Does * p ++ increment p or what it points to?