1.find the second maximum in an array?
2.how do you create hash table in c?
3.what is hash collision

Answer Posted / rao

#include<stdio.h>

int main()
{
int arr[] = {2,3,20,7,8,1};
int max, sec;
int i;
max=0;
sec=0;
for ( i=0; i< 6; i++)
{
if(arr[i] > max)
max = arr[i];
}

for ( i=0; i< 6; i++)
{
if ( (arr[i] > sec) && (arr[i] < max))
sec = arr[i];
}
printf(" max=%d\n sec=%d\n", max, sec);
}

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why isn't it being handled properly?

731


Differentiate between Macro and ordinary definition.

829


What is a function simple definition?

727


Here is a good puzzle: how do you write a program which produces its own source code as output?

686


How many parameters should a function have?

761






Explain what is the general form of a c program?

705


Write a program to generate random numbers in c?

750


Can you write a programmer for FACTORIAL using recursion?

704


What are the advantages of using Unions?

732


What is getch() function?

745


What are structures and unions? State differencves between them.

712


Is there a way to jump out of a function or functions?

747


What are the standard predefined macros?

726


How the c program is executed?

736


What is c definition?

837