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.
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;
}
Comments
Leave a comment