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


Please Help Members By Posting Answers For Below Questions

What do you mean by keywords in c?

614


What is the value of h?

579


FILE *fp1,*fp2; fp1=fopen("one","w") fp2=fopen("one","w") fputc('A',fp1) fputc('B',fp2) fclose(fp1) fclose(fp2)} a.error b. c. d.

1185


How do I copy files?

614


When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd

633






What is the difference between memcpy and memmove?

589


The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none

700


How can you call a function, given its name as a string?

704


Explain the difference between exit() and _exit() function?

624


What is pragma c?

601


write a progrmm in c language take user interface generate table using for loop?

1563


Why isn't it being handled properly?

632


WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..

1582


the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters

1791


What is binary tree in c?

617