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
string reverse using recursion
What is keyword with example?
Why main is used in c?
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
What is floating point constants?
What are different storage class specifiers in c?
how to execute a program using if else condition and the output should enter number and the number is odd only...
Dont ansi function prototypes render lint obsolete?
What is conio h in c?
Why use int main instead of void main?
What is a stream water?
How do I swap bytes?
Why do we use & in c?
What is getch() function?
Can you please explain the difference between exit() and _exit() function?