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
What is cohesion in c?
When we use void main and int main?
Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff
What is the most efficient way to count the number of bits which are set in an integer?
How do you generate random numbers in C?
Why is a semicolon (;) put at the end of every program statement?
Why is structure padding done in c?
Difference between malloc() and calloc() function?
Explain the difference between #include "..." And #include <...> In c?
Why calloc is better than malloc?
How many identifiers are there in c?
Explain what is the difference between the expression '++a' and 'a++'?
Is Exception handling possible in c language?
Is it better to use a macro or a function?
What are the 5 elements of structure?