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
i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical
What is sizeof array?
How do I use strcmp?
What does #pragma once mean?
the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none
what type of questions arrive in interview over c programming?
a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none
Why is not a pointer null after calling free?
string reverse using recursion
What are the types of macro formats?
What is the heap?
What is page thrashing?
What is indirection?
When a c file is executed there are many files that are automatically opened what are they files?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;