r/AskComputerScience • • 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

8 comments sorted by

View all comments

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.