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
When would you use a pointer to a function?
Is c object oriented?
diff between exptected result and requirement?
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(); }
How to establish connection with oracle database software from c language?
Explain what are global variables and explain how do you declare them?
Explain the difference between strcpy() and memcpy() function?
what do u mean by Direct access files? then can u explain about Direct Access Files?
Which is an example of a structural homology?
Why doesnt long int work?
all c language question
Compare interpreters and compilers.
What would be an example of a structure analogous to structure c?
Why functions are used in c?
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