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

How is = symbol different from == symbol in c programming?

624


what is use of malloc and calloc?

1393


Explain what’s a signal? Explain what do I use signals for?

619


What is omp_num_threads?

592


Explain built-in function?

605






What is double pointer in c?

599


Why isn't it being handled properly?

655


Explain the difference between structs and unions in c?

589


how is the examination pattern?

1605


What are the benefits of c language?

657


Write a program to print ASCII code for a given digit.

698


What is the difference between array and pointer?

575


How can I make sure that my program is the only one accessing a file?

691


What are local variables c?

556


A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(

1752