MIPI_BaseC_WebinarFRTK/08_Lecture08/02_arr_min_p13.c

40 lines
589 B
C
Raw Normal View History

2024-11-13 09:22:28 +03:00
#include <stdio.h>
#include <inttypes.h>
#define SIZE 5
int Input(int* arr, int n)
{
int i;
for(i=0;i<n;i++)
scanf("%d",&arr[i]);
return i;
}
void Print(int *arr,int len)
{
int i;
for (i = 0; i < len; i++)
printf("%d ",arr[i]);
printf("\n");
}
int Min(int *arr,int len)
{
int min=arr[0],i;
for (i = 0; i < len; i++)
{
if (min > arr[i])
min = arr[i];
}
return min;
}
int main(int argc, char **argv)
{
int arr[SIZE]={0};
Input(arr,SIZE);
printf("Min = \t\t%d\n",Min(arr,SIZE));
return 0;
}