Passing Arguments
Finding the Maximum Element in an Array
main.c
123456789101112131415161718192021222324252627#include <stdio.h> int findMaxElement(int arr[]) // 1 { int max = arr[0]; // 2 for (int i = 1; i < 5; i++) // 3 { if (arr[i] > max) // 3 { max = arr[i]; // 4 } } return max; } int main() { int array[] = { 10, 5, 7, 14, 3 }; int maxElement = findMaxElement(array); printf("Max element is: %d\n", maxElement); return 0; }
Tehtävä
Swipe to start coding
Craft a function that determines the smallest element of an array.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 5. Luku 4
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Awesome!
Completion rate improved to 2.63Awesome!
Completion rate improved to 2.63
Passing Arguments
Finding the Maximum Element in an Array
main.c
123456789101112131415161718192021222324252627#include <stdio.h> int findMaxElement(int arr[]) // 1 { int max = arr[0]; // 2 for (int i = 1; i < 5; i++) // 3 { if (arr[i] > max) // 3 { max = arr[i]; // 4 } } return max; } int main() { int array[] = { 10, 5, 7, 14, 3 }; int maxElement = findMaxElement(array); printf("Max element is: %d\n", maxElement); return 0; }
Tehtävä
Swipe to start coding
Craft a function that determines the smallest element of an array.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 5. Luku 4
single
Awesome!
Completion rate improved to 2.63
Passing Arguments
Pyyhkäise näyttääksesi valikon
Finding the Maximum Element in an Array
main.c
123456789101112131415161718192021222324252627#include <stdio.h> int findMaxElement(int arr[]) // 1 { int max = arr[0]; // 2 for (int i = 1; i < 5; i++) // 3 { if (arr[i] > max) // 3 { max = arr[i]; // 4 } } return max; } int main() { int array[] = { 10, 5, 7, 14, 3 }; int maxElement = findMaxElement(array); printf("Max element is: %d\n", maxElement); return 0; }
Tehtävä
Swipe to start coding
Craft a function that determines the smallest element of an array.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!