0
A problem with thinking.
Can you guys explain to me how to make a programme that after giving "k" values into an array, prints the biggest number from them? Please guys, I am helpless :(
5 Réponses
+ 9
I have a problem with thinking :c
+ 5
do it while you giving the input.
1) define a max variable
2) have a special case for the first input so it become the current max
3) for every new input, compare to the current max and if it is bigger, make it the new max
4) ....???
5) profit!!!
+ 4
check in my codes for 'Find max value in array'
or click here: https://code.sololearn.com/cS9e7F6NfM58/#cs
make sure to press 'return' after each value (put all values beforehand) and -1 should be the last value (just special value to indicate end of array and can be changed in the program)
like this:
input:
5
3
75
388
9
211
-1
+ 1
In python there is a max() function, that accepts list as an argument, and returns the maximum value.
I haven't done C++, but in C there is no such library function available on array. You can write a user defined function. Try yourself
Let me know if you're unable to.
0
Thanks a lot guys! :)