Answer to Question #341225 in C++ for PriseMasia

Question #341225

Write a program that uses a for statement to find the smallest of several integers.


Assume that the first value read specifies the number of values remaining and that the


first number is not one of the integers to compare.



1
Expert's answer
2022-05-15T16:59:37-0400
int min(int *arr){
   int min = INT_MAX;
   int n = arr[0];
   
   for(int i = 1; i <= n; i++){
      if(arr[i] < min){
         min = arr[i];
      }
   }
   
   return min;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS