1var peopleData = [
2 { name: "Paul", height: 180, age: 21 },
3 { name: "Johnny", height: 198, age: 43 },
4 { name: "Brad", height: 172, age: 49 },
5 { name: "Dwayne", height: 166, age: 15 }
6];
7
8//Find biggest height number
9var maxHeight = 0;
10
11for (var i = 0; i < heights.length; i++) {
12 if (peopleData[i].height > maxHeight) {
13 maxHeight = peopleData[i].height;
14 //if you console.log(maxHeight); you should get 198
15 }
16}
1function maisBaratosQue(valor, precos) {
2 return precos.filter(p => p <= valor);
3}
1
2#include <iostream>
3using namespace std;
4int main()
5{
6 // input
7 int n;
8 cin >> n;
9 int arr[10];
10 int maxNum;
11 for (int i = 0; i < n; i++)
12 {
13 cin >> arr[i];
14 }
15
16 // Algo
17 maxNum = arr[0];
18 for (int i = 0; i < n; i++)
19 {
20 if (maxNum < arr[i])
21 {
22 maxNum = arr[i];
23 }
24 }
25
26 // output
27 cout << maxNum;
28 // for (int i = 0; i < n; i++)
29 // {
30 // cout << arr[i] << " ";
31 // }
32
33 return 0;
34}