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

When would you use a pointer to a function?

589


Is c object oriented?

542


diff between exptected result and requirement?

1594


find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }

1857


How to establish connection with oracle database software from c language?

1675






Explain what are global variables and explain how do you declare them?

642


Explain the difference between strcpy() and memcpy() function?

595


what do u mean by Direct access files? then can u explain about Direct Access Files?

1642


Which is an example of a structural homology?

785


Why doesnt long int work?

613


all c language question

1873


Compare interpreters and compilers.

639


What would be an example of a structure analogous to structure c?

576


Why functions are used in c?

587


an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational

812