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

What is d'n in c?

630


Can you write a programmer for FACTORIAL using recursion?

608


How will you print TATA alone from TATA POWER using string copy and concate commands in C?

916


Why c is called a middle level language?

634


What is c value paradox explain?

570






What are the types of type qualifiers in c?

645


Tell me what is null pointer in c?

611


The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.

1056


What are the differences between new and malloc in C?

607


Can include files be nested? How many levels deep can include files be nested?

653


What is the difference between a function and a method in c?

558


What do header files do?

601


Why do we use return in c?

565


What are the uses of null pointers?

588


Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

1738