Commit 870c424f by matjul

Upload New File

parent 766d0511
Showing with 49 additions and 0 deletions
#include <stdio.h>
#include <stdlib.h>
void function(int array[10], int *min, int *max);
int main(){
int array[10];
int i, min, max;
for(i = 0; i < 10; i++){
array[i] = rand() % 101;
printf("%d ", array[i]);
}
printf("\n");
function(array, &min, &max);
printf("The maximum value: %d and the minimun value: %d ", max, min);
return 0;
}
void function(int array[10], int *min, int *max){
int i;
*max = array[0];
*min = array[0];
for(i = 1; i < 10; i++){
if(*max < array[i]){
*max = array[i];
}
}
for(i = 1; i < 10; i++){
if(*min > array[i]){
*min = array[i];
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment