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
Explain argument and its types.
Explain modulus operator.
Can i use “int” data type to store the value 32768? Why?
Can you please explain the difference between exit() and _exit() function?
Explain bitwise shift operators?
Can the size of an array be declared at runtime?
Is fortran still used today?
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above
5 Write an Algorithm to find the maximum and minimum items in a set of ‘n’ element.
What is pass by reference in functions?
Is it fine to write void main () or main () in c?
What is a structure and why it is used?
Is struct oop?
What is page thrashing?
pierrot's divisor program using c or c++ code