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 to establish connection with oracle database software from c language?
Which is more efficient, a switch statement or an if else chain?
write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.
What are the loops in c?
Why doesnt that code work?
Can an array be an Ivalue?
What is sizeof in c?
Explain how do you convert strings to numbers in c?
What is #define used for in c?
What language is lisp written in?
Write a program to swap two numbers without using the third variable?
disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit
Differentiate Source Codes from Object Codes
number of times a digit is present in a number
Suppose we have a table name EMP as below. We want to perform a operation in which, I want to change name ‘SMITH’ from as ‘SMITH JAIN’. Also I want to change the name of the column from ENAME to E_NAME. EMPNO ENAME JOB MGR HIREDATE SAL 7369 SMITH Coder 7902 17-DEC-80 800 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 7521 WARD SALESMAN 7698 22-FEB-81 1250