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



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

Post New Answer

More C Interview Questions

1)what are limitations for recursive function? 2)write a program to read a text file and count the number of characters in the text file

1 Answers  


Explain what are the __date__ and __time__ preprocessor commands?

0 Answers  


How can I set an array's size at run time?

9 Answers  


plz answer.. a program that takes a string e.g. "345" and returns integer 345

4 Answers  


Write a program to add a given duration with time(24hrs format)

1 Answers   Protech,


what is difference between getchar,putchar functions and printf and scanf function? does putchar show output only when input given to it

5 Answers   DIT,


What is the difference between abs() and fabs() functions?

0 Answers  


what is mallloc()?how it works?

4 Answers   Excel,


post new interiew question and aptitude test papers

1 Answers  


what is d pitfalls of registers variables

3 Answers   TCS,


what is use#in c

3 Answers  


What are Macros? What are its advantages and disadvantages?

0 Answers   TCS,


Categories