WRITE A C PROGRAM TO FIND SECOND BIGGEST VALUE FROM THE
GIVEN VALUES
Answer Posted / 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 View All Answers
Array is an lvalue or not?
What is ambagious result in C? explain with an example.
Is c is a high level language?
Is null valid for pointers to functions?
What are the types of arrays in c?
Explain modulus operator. What are the restrictions of a modulus operator?
What is int main () in c?
Where are the auto variables stored?
What is the difference between far and near ?
Explain 'bit masking'?
What is "Duff's Device"?
What is calloc()?
When should a type cast not be used?
What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?
How can you invoke another program from within a C program?