0
How to get largest of five numbers using arrays
3 Respostas
+ 4
int nums[5] = {2,5,7,3,4};
int l = nums[0];
for(int x=1; x<5; x++)
if(nums[x] > l)
l = nums[x];
cout << l;
+ 5
Add the language tag to your post. C++, Py, ..
+ 1
Sort an array and then take five last (or first, depends on sorting) values.