subject

Write a program that outputs the biggest difference (absolute value) between any successive pair of numbers in a list. Such a list might represent daily stock market prices or daily temperatures, so the difference represents the biggest single-day change. The input is the list size, followed by the numbers. If the input is 5 60 63 68 61 59, the output is 7. Hints:
Declare a variable for the current number, and another for the previous number. At the start of each loop iteration, set prevNum
currNum, then get the next number into currNum; Maintain a max difference variable. Initialize it with 0. In each loop iteration, check if the difference between currNum and prevNum exceeds maxDiff, if so, update maxDiff with that difference Don't forget to take the absolute value of the difference before the above comparison Don't try to check the max difference for the first number in the list, since no previous number exists.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 19:30
What are loans to a company or government for a set amount of time
Answers: 1
question
Computers and Technology, 24.06.2019 00:30
The best definition of an idiom is a. a word or phrase that describes a noun b. a word or phrase describing a verb c. a phrase containing figurative language in which the word expresses a different idea from its exact meaning d. a phrase that compares two unlike objects or ideas
Answers: 2
question
Computers and Technology, 24.06.2019 05:30
Hey i really need some solving this problem: 1. encrypt this binary string into cipher text: 110000. include in your answer the formula the decoder would use to decrypt your cipher text in the format (coded answer) x n mod (m) = y & 2. decrypt this cipher text into a binary string: 106 you.
Answers: 2
question
Computers and Technology, 24.06.2019 09:30
What is the definition of digital literacy?
Answers: 1
You know the right answer?
Write a program that outputs the biggest difference (absolute value) between any successive pair of...
Questions
question
English, 02.12.2020 07:30
question
Mathematics, 02.12.2020 07:30
question
Chemistry, 02.12.2020 07:30
question
Mathematics, 02.12.2020 07:30
question
Mathematics, 02.12.2020 07:30
question
Chemistry, 02.12.2020 07:30
Questions on the website: 13722363