Lab 1 done
This commit is contained in:
4
Q1.c
4
Q1.c
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user