max function in arrays
i am writing a program to output change for a vending machine in the minimum amount of coins. I want a way to select the corrent number from the array which is closest to the change value which is inputted for example: input 65, the closest value would be 50. I am sorry if my code is bad im really new
10 Replies
i tried inpurtting the targetChange variable after max like that but it gave me errors which i dont understand
you are not closing the (
it still gives me the max of the array
i just get 200 outputted everytime
even if i input like 60
well yes because that's the maxinum number in the array
that's what
Max
doesdo i need to use a loop
and stop when it gets to one bigger
that would be a good start
school making me use c# im so bad ðŸ˜
i cld do it in py
u know any good places to learn
for a complete noob
$helloworld
Written interactive course https://learn.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/tutorials/
Videos https://dotnet.microsoft.com/learn/videos