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

Why array is used in c?

0 Answers  


main() { static char *s[]={"black","white","yellow","voilet"}; char **ptr[]={s+3,s+2,s+1,s}, ***p; p=ptr; **++p; printf("%s",*--*++p+3); }

1 Answers  


What are Macros? What are its advantages and disadvantages?

0 Answers   TCS,


Design a program using an array that lists even numbers and odd numbers separately from the 12 numbers supplied by a user.

8 Answers  


What is meant by realloc()?

0 Answers  






difference between malloc and calloc

3 Answers   HCL, Wipro,


What are identifiers and keywords in c?

0 Answers  


When is a void pointer used?

0 Answers  


What are the storage classes in C?

0 Answers  


Is sizeof a keyword in c?

0 Answers  


write a program to copy the string using switch case?

0 Answers   Mind Tree,


Write a program to find given number is even or odd without using any control statement.

2 Answers  


Categories