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 the salient features of c languages?
What is 'bus error'?
hi, which software companys will take,if d candidate's % is jst 55%?
What are the properties of union in c?
What is the maximum length of an identifier?
What are loops c?
What is string length in c?
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321
ATM machine and railway reservation class/object diagram
Write a code to generate a series where the next element is the sum of last k terms.
What is a structure member in c?
What is the difference between call by value and call by reference in c?
What is const and volatile in c?
What is the difference between void main and main in c?
What is a struct c#?