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 is = symbol different from == symbol in c programming?
what is use of malloc and calloc?
Explain what’s a signal? Explain what do I use signals for?
What is omp_num_threads?
Explain built-in function?
What is double pointer in c?
Why isn't it being handled properly?
Explain the difference between structs and unions in c?
how is the examination pattern?
What are the benefits of c language?
Write a program to print ASCII code for a given digit.
What is the difference between array and pointer?
How can I make sure that my program is the only one accessing a file?
What are local variables c?
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.. :(