/* This is the tenth lab of Lab EE107
The purpose of this lab for finding the minimum value in an array
by calling a function.
Creating the code and free of syntax and grammatical errors.
Author: Ekwegbalum Unachukwu
Star ID:do2170dt
Date: April 2nd, 2024.
*/
#include <stdio.h>
// Function to find the minimum value in an array
int minimum_EU(int values_EU[], int n_EU) {
int minValue_EU, i;
minValue_EU = values_EU[0]; // Initialize minValue with the first element of the array
// Iterate through the array to find the minimum value
for (i = 1; i < n_EU; ++i) {
if (values_EU[i] < minValue_EU) {
minValue_EU = values_EU[i]; // Update minValue if a smaller value is found
}
}
return minValue_EU;
}
int main(void) {
int scores_EU[10], i, minScore_EU;
printf("Enter 10 scores\n");
// Input scores
for (i = 0; i < 10; ++i) {
scanf("%i", &scores_EU[i]);
// Check if the score entered is less than 10
if (scores_EU[i] < 10) {
printf("Score entered is less than 10\n");
}
}
// Find the minimum score
minScore_EU = minimum_EU(scores_EU, 10);
// Display the minimum score
printf("\nMinimum score is %i\n", minScore_EU);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: