Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Passando Argumentos | Funções
Fundamentos de C

bookPassando Argumentos

Encontrando o Elemento Máximo em um Array

main.c

main.c

copy
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; }
Tarefa

Swipe to start coding

Crie uma função que determine o menor elemento de um array.

Solução

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 5. Capítulo 4
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

Suggested prompts:

Can you explain how to find the maximum element in an array?

What is the time complexity of finding the maximum element in an array?

Can you provide an example with a sample array?

close

Awesome!

Completion rate improved to 2.63

bookPassando Argumentos

Deslize para mostrar o menu

Encontrando o Elemento Máximo em um Array

main.c

main.c

copy
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; }
Tarefa

Swipe to start coding

Crie uma função que determine o menor elemento de um array.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 5. Capítulo 4
single

single

some-alt