# Lesson 6.While loop

## Problem «List of squares» (Easy)

#### Statement

For a given integer N, print all the squares of integer numbers where the square is less than or equal to N, in ascending order.## Problem «Least divisor» (Easy)

#### Statement

Given an integer not less than 2. Print its smallest integer divisor greater than 1.## Problem «The power of two» (Medium)

#### Statement

For a given integer**N**, find the greatest integer

**x**where \( 2^x \) is less than or equal to

**N**. Print the exponent value and the result of the expression \( 2^x \).

Don't use the operation `**`

.

## Problem «Morning jog» (Easy)

#### Statement

As a future athlete you just started your practice for an upcoming event. Given that 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 for you to finally reach the required distance for the event, if you increases your distance each day by 10% from the previous day.

Print one integer representing the number of days to reach the required distance.

## Problem «The length of the sequence» (Easy)

#### Statement

Given a sequence of non-negative integers, where each number is written in a separate line. Determine the length of the sequence, where the sequence ends when the integer is equal to 0. Print the length of the sequence (not counting the integer 0). The numbers following the number 0 should be omitted.## Problem «The sum of the sequence» (Medium)

#### Statement

Determine the sum of all elements in the sequence, ending with the number 0.## Problem «The average of the sequence» (Medium)

#### Statement

Determine the average of all elements of the sequence ending with the number 0.## Problem «The maximum of the sequence» (Medium)

#### Statement

A sequence consists of integer numbers and ends with the number 0. Determine the largest element of the sequence.## Problem «The index of the maximum of a sequence» (Hard)

#### Statement

A sequence consists of integer numbers and ends with the number 0. Determine the index of the largest element of the sequence. If the highest element is not unique, print the index of the first of them.## Problem «The number of even elements of the sequence» (Medium)

#### Statement

Determine the number of even elements in the sequence ending with the number 0.## Problem «The number of elements that are greater than the previous one» (Hard)

#### Statement

A sequence consists of integer numbers and ends with the number 0. Determine how many elements of this sequence are greater than their neighbours above.## Problem «The second maximum» (Hard)

#### Statement

The sequence consists of distinct positive integer numbers and ends with the number 0. Determine the value of the second largest element in this sequence. It is guaranteed that the sequence has at least two elements.## Problem «The number of elements equal to the maximum» (Hard)

#### Statement

A sequence consists of integer numbers and ends with the number 0. Determine how many elements of this sequence are equal to its largest element.## Problem «Fibonacci number» (Hard)

#### Statement

The Fibonacci sequence is defined as follows:*φ*_{0} = 0, *φ*_{1} = 1, *φ*_{n} = *φ*_{n-1} + *φ*_{n-2}.

For the given number *n* define *n*th Fibonacci number *φ _{n}*.

This problem can also be solved with the `for`

loop.

## Problem «The index of Fibonacci number» (Hard)

#### Statement

Given an integer number*A*. Determine its index among the Fibonacci numbers, that is, print the number

*n*,

*φ*. If

_{n}= A*A*is not a Fibonacci number, print -1.