Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


WRITE A C PROGRAM TO FIND SECOND BIGGEST VALUE FROM THE
GIVEN VALUES



WRITE A C PROGRAM TO FIND SECOND BIGGEST VALUE FROM THE GIVEN VALUES..

Answer / naveen

#include<stdio.h>
#include<math.h>
void main()
{
int a[],n,b;
printf("Enter the number of digits you want to enter:");
scanf(%d",&n);
printf("Enter the different values you want:")
for(i=0;i<=n;i++)
{
scanf(%d",a[i]);
}
/* This will make the values to be arranged in descending
order*/
for(i=0;i<=n;i++)
{
if(a[i] >> a[i+1])
{

}
else
{
b = a[i];
a[i] = a[i+1];
a[i+1] = b;
}
}
/* As a[0] will be the max value the next to it a[1] will be
second highest*/
printf("The second largest value will be: %d",&a[1]);
}

Is This Answer Correct ?    36 Yes 42 No

Post New Answer

More C Interview Questions

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

9 Answers   HCL, Qualcomm,


why array index always starts from zero??

4 Answers   TCS,


what is difference between overriding and overloading?

1 Answers  


Explain how do you determine whether to use a stream function or a low-level function?

0 Answers  


how will you write a program on linked lists using JAVA programming???????????

1 Answers   Keane India Ltd,






C program to find all possible outcomes of a dice?

0 Answers  


Write a program to display the no of bit difference between any 2 given numbers eg: Num1 will 12->1100 Num2 will 7->0111 the difference in bits are 2.

4 Answers  


write a program to display the frequency of each element in a given array in c language

1 Answers  


Do pointers need to be initialized?

0 Answers  


What is the meaning When we write "#include" what is # and what does include does there???

22 Answers   HCL, Wipro,


WHAT IS MEANT BY LIFE?

2 Answers  


what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above

0 Answers  






Categories