Loop with the condition
While1°. Two positive real numbers A and B (A > B) are given. A segment of length A contains the greatest possible amount of segments of length B (without overlaps). Not using multiplication and division, find the length of unused part of the segment A.
While2°. Two positive real numbers A and B (A > B) are given. A segment of length A contains the greatest possible amount of segments of length B (without overlaps). Not using multiplication and division, find the amount of segments B, which are placed on the segment A.
While3. Two positive integers N and K are given. Using addition and subtraction only, find a quotient of the integer division N on K and also a remainder after this division.
While4°. An integer N (> 0) is given. If it equals 3 raised to some integer power then output True, otherwise output False.
While5. Given an integer N (> 0) that equals 2 raised to some integer power: N = 2K, find the exponent K of the power.
While6. Given an integer N (> 0), compute the double factorial of N: N!! = N·(N−2)·(N−4)·…, where the last factor equals 2 if N is an even number, and 1 otherwise. To avoid the integer overflow, compute the double factorial using a real variable and output the result as a real number.
While7°. Given an integer N (> 0), find the smallest positive integer K such that its square is greater than N: K2 > N. Do not use the operation of extracting a root.
While8. Given an integer N (> 0), find the largest integer K such that its square is not greater than N: K2 ≤ N. Do not use the operation of extracting a root.
While9. Given an integer N (> 1), find the smallest integer K such that the inequality 3K > N is fulfilled.
While10. Given an integer N (> 1), find the largest integer K such that the inequality 3K < N is fulfilled.
While11°. An integer N (> 1) is given. Find the smallest integer K such that the sum 1 + 2 + … + K is greater than or equal to N. Output K and the corresponding sum.
While12°. An integer N (> 1) is given. Find the largest integer K such that the sum 1 + 2 + … + K is less than or equal to N. Output K and the corresponding sum.
While13. A real number A (> 1) is given. Find the smallest integer K such that the sum 1 + 1/2 + … + 1/K is greater than A. Output K and the corresponding sum.
While14. A real number A (> 1) is given. Find the largest integer K such that the sum 1 + 1/2 + … + 1/K is less than A. Output K and the corresponding sum.
While15. A principal of 1000 euro is invested at a rate of P percent compounded annually. A real number P is given, 0 < P < 25. Find, how many years K it will take for an investment to exceed 1100 euro. Output K (as an integer) and the compound amount S of the principal at the end of K years (as a real number).
While16. The skier began trainings having run 10 km. Each next day he increased the run distance by P percent from the distance of the last day. A real number P is given, 0 < P < 50). Find, how many days K it will take for a total run to exceed 200 km. Output K (as an integer) and the total run S (as a real number).
While17. Given an integer N (> 0), output all digits of the number N starting from the right digit (a ones digit). Use the operators of integer division and taking the remainder after integer division.
While18. Given an integer N (> 0), find the amount and the sum of its digits. Use the operators of integer division and taking the remainder after integer division.
While19. An integer N (> 0) is given. Output an integer obtained from the given one by reading it from right to left. Use the operators of integer division and taking the remainder after integer division.
While20. An integer N (> 0) is given. Determine whether its decimal representation contains a digit "2" or not, and output True or False respectively. Use the operators of integer division and taking the remainder after integer division.
While21. An integer N (> 0) is given. Determine whether its decimal representation contains odd digits or not, and output True or False respectively. Use the operators of integer division and taking the remainder after integer division.
While22°. An integer N (> 1) is given. If it is a prime number, i. e., it has not positive divisors except 1 and itself, then output True, otherwise output False.
While23°. Two positive integers A and B are given. Find their greatest common divisor (GCD) using the Euclidean algorithm: GCD(A, B) = GCD(B, A mod B), if B ≠ 0; GCD(A, 0) = A, where "mod" denotes the operator of taking the remainder after integer division.
While24. An integer N (> 1) is given. An integer-valued sequence of the Fibonacci numbers FK is defined as: F1 = 1, F2 = 1, FK = FK−2 + FK−1, K = 3, 4, … . Determine whether N is a Fibonacci number or not, and output True or False respectively.
While25. Given an integer N (> 1), find the first Fibonacci number greater than N (see the Fibonacci numbers definition in While24).
While26. Given an integer N (> 1) that is a Fibonacci number: N = FK, output previous and next Fibonacci numbers: FK−1 and FK+1 (see the Fibonacci numbers definition in While24).
While27. Given an integer N (> 1) that is a Fibonacci number: N = FK, find its order number K (see the Fibonacci numbers definition in While24).
While28. A real number ε (> 0) is given. A sequence of real numbers AK is defined as: A1 = 2, AK = 2 + 1/AK−1, K = 2, 3, … . Find the first index K such that the inequality |AK − AK−1| < ε is fulfilled. Output the index K and the terms AK−1 and AK.
While29. A real number ε (> 0) is given. A sequence of real numbers AK is defined as: A1 = 1, A2 = 2, AK = (AK−2 + 2·AK−1)/3, K = 3, 4, … . Find the first index K such that the inequality |AK − AK−1| < ε is fulfilled. Output the index K and the terms AK−1 and AK.
While30. Three positive real numbers A, B, C are given. A rectangle of size A × B contains the greatest possible amount of squares with side C (without overlaps). Find the amount of squares placed on the rectangle. Do not use the operators of multiplication and division.
|