Lab 1 done

This commit is contained in:
2024-09-22 12:37:40 -05:00
parent 8179bad76e
commit da1644e7c8

4
Q1.c
View File

@@ -1,6 +1,7 @@
#include <stdio.h>
// Question 1:
// Function to find maximum
int find_maximum(const int arr[], int len) {
int max = arr[0];
@@ -11,7 +12,6 @@ int find_maximu m(const int arr[], int len) {
}
return max;
}
// Function to find minimum
int find_minimum(const int arr[], int len) {
int min = arr[0];
@@ -22,7 +22,6 @@ int find_minimum(const int arr[], int len) {
}
return min;
}
// Function to find amount temperatures above given threshold
int above_threshold(const int arr[], int len, int threshold) {
int count = 0;
@@ -32,7 +31,6 @@ int above_threshold(const int arr[], int len, int threshold) {
}
return count;
}
// Passed arrays are const because they shouldn't be modified in the functions
int main() {
// The array of temps, and threshold value to be used to test