Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Explain argument and its types.

1011


Explain modulus operator.

1009


Can i use “int” data type to store the value 32768? Why?

1152


Can you please explain the difference between exit() and _exit() function?

1001


Explain bitwise shift operators?

1188


Can the size of an array be declared at runtime?

1041


Is fortran still used today?

1055


in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above

1028


5 Write an Algorithm to find the maximum and minimum items in a set of ‘n’ element.

2062


What is pass by reference in functions?

790


Is it fine to write void main () or main () in c?

980


What is a structure and why it is used?

1152


Is struct oop?

971


What is page thrashing?

1035


pierrot's divisor program using c or c++ code

2184