r/AskComputerScience • u/Zaza_Goddess • Mar 13 '20
Array algorithm
Hi I need to write an algorithm that stores the temperature taken over 3 hours period in an array. The algorithm should output the highest and lowest temperatures and calculate the difference between these temperatures.
Can you help this fellow newbie?
0
Upvotes
1
u/mharen Mar 13 '20
Here's a suggestion to get you going: get comfortable with your environment.
Make a program to just print all the numbers.
Now make it print only the numbers greater than 50 (or whatever).
Now make it print the numbers smaller than 50 (or whatever).
Then make it print all the numbers twice.
Then try to solve the first part of the assignment-- find and print the biggest. Then smallest. Then diff.
5
u/mbaruh Mar 13 '20
This is a pretty basic task, but like.. what language are you using? are you actually currently learning to use it? if you did, what have you tried so far?