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 |
Why array is used in c?
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); }
What are Macros? What are its advantages and disadvantages?
Design a program using an array that lists even numbers and odd numbers separately from the 12 numbers supplied by a user.
What is meant by realloc()?
difference between malloc and calloc
What are identifiers and keywords in c?
When is a void pointer used?
What are the storage classes in C?
Is sizeof a keyword in c?
write a program to copy the string using switch case?
Write a program to find given number is even or odd without using any control statement.