#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void findsmalllarge(int *arr, int n)
{
int min = INT_MAX;
int max = INT_MIN;
for (int i = 0; i < n; i++)
{
if (arr[i] < min)
{
min = arr[i];
}
if (arr[i] > max)
{
max = arr[i];
}
}
for (int i = 0; i < n; i++)
{
printf("%d ", arr[i]);
}
printf("\nlargest and samllest are : %d and %d", min, max);
}
int main()
{
clock_t t;
t = clock();
int n;
printf("enter the size of array : ");
scanf("%d", &n);
int arr[n];
for (int i = 0; i < n; i++)
{
arr[i] = rand();
}
findsmalllarge(arr, n);
t = clock() - t;
double time_taken = ((double)t) / CLOCKS_PER_SEC;
printf("\nfun() took %f seconds to execute \n", time_taken);
return 0;
}