The index of the maximum of a sequence

The index of the maximum of a sequence. A sequence consists of integer numbers and ends with the number 0. Determine the index of the largest element in the sequence. If the largest element is not unique, print the index of the first occurrence. Test Case Input (Sequence) Expected Output 1 1 2 3 0 …

The maximum of the sequence

The maximum of the sequence. A sequence consists of integer numbers and ends with the number 0. Determine the largest element in the sequence. Test Case Input (Sequence) Expected Output 1 1 2 3 0 3 2 4 0 1 2 4 3 7 3 5 0 7  

The sum of the sequence

The sum of the sequence. Determine the sum of all elements in a sequence of non-negative integers, where the sequence ends with the number 0. Do not include the 0 in the sum. Test Case Input (Sequence) Expected Output 1 1 2 3 0 6 2 4 0 1 2 4 3 7 3 5 …

The length of the sequence

The length of the sequence. Given a sequence of non-negative integers where each number is written on a separate line, determine the length of the sequence. The sequence ends when an integer equal to 0 is encountered. Print the length of the sequence, excluding the integer 0. Numbers following the number 0 should be omitted. …

Morning jog

Morning jog. As a future athlete, you are training for an upcoming event. On the first day, you run x miles, and by the event, you must be able to run y miles. Calculate the number of days required to reach the required distance for the event if you increase your distance by 10% each day from …

The power of two

The power of two. For a given integer N, find the greatest integer x such that 2x is less than or equal to N. Print the exponent value and the result of the expression 2x. Do not use the ** operation. Test Case Input (N) Expected Output 1 10 3 8 2 20 4 16 3 …

Least divisor

Least divisor. Given an integer not less than 2, print its smallest integer divisor greater than 1. Test Case Input (Integer) Expected Output 1 10 2 2 15 3 3 17 17