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 program to find the smallest and largest element in
a given array in c language

Answer Posted / harish

with respect to solution posted by "Hari Prasad Perabattula"

if(n%2) {
if(arr[2] < min)
min = arr[2];
if(arr[2] > max)
max = arr[2];
start = 3;
}

must be changed as

if(n%2) {
if(arr[2] < tmin)
tmin = arr[2];
if(arr[2] > tmax)
tmax = arr[2];
start = 3;
}

bcos if the 3 element in the array is the smallest then we
ignore that once we enter the for loop if min and max are
updated.

Is This Answer Correct ?    15 Yes 26 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

difference between object file and executable file

6741


What is context in c?

932


What is the difference between null pointer and wild pointer?

1205


Distinguish between actual and formal arguments.

1088


Explain a pre-processor and its advantages.

1145


What will the preprocessor do for a program?

1086


pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)

2349


write a c program for swapping two strings using pointer

2641


Why cant I open a file by its explicit path?

1042


Why should I use standard library functions instead of writing my own?

1274


what is the difference between class and unio?

2374


Why do we use header files in c?

1084


What are the ways to a null pointer can use in c programming language?

1145


Where are some collections of useful code fragments and examples?

1166


why wipro wase

2321