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 09:10
Effective character encoding requires standardized code. compatible browsers. common languages. identical operating systems.
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
Best laptops for college [$100-$500 range]?
Answers: 2
question
Computers and Technology, 24.06.2019 08:10
Where are american poets found in the dewey decimal system
Answers: 1
question
Computers and Technology, 24.06.2019 17:30
Looking at the electroscope, describe how you can cause the two leaves at the bottom to repel each other and stay that way
Answers: 3
You know the right answer?
Write a program that outputs the biggest difference (absolute value) between any successive pair of...
Questions
question
Mathematics, 10.11.2020 18:50
question
Mathematics, 10.11.2020 18:50
question
Mathematics, 10.11.2020 18:50
question
History, 10.11.2020 18:50
Questions on the website: 13722363