Programming-Cpp

Tasks studies - laboratory


Project maintained by dawidolko Hosted on GitHub Pages — Theme by dawidolko

Examples

Task. 1.

Write an algorithm/program that checks which of the 99 numbers entered from the keyboard are divisible by 5.

Task. 2.

Write an algorithm/program that checks whether the number entered from the keyboard is prime.

Task. 3.

Write an algorithm/program that calculates the product 2462n for any defined n belonging to N - provided by the user.

Task. 4.

Write a program that, after entering the number n, prints the sum of even numbers less than n.

Task. 5.

Write an algorithm/program that solves the equation 𝑎𝑥 + 𝑏 = 1 after the user enters the numbers 𝑎 and 𝑏.

Task. 6.

Write an algorithm/program that calculates the value of 𝑎𝑏 for the entered nonzero integer/natural numbers 𝑎 and 𝑏.

Task. 7.

Write an algorithm/program that will allow you to enter 5 numbers and print the sum of the entered positive numbers and their quantity.

Task. 8.

Write a program for the following algorithm


algorytm2

Task. 9.

The data is n natural. Write an algorithm/program that will determine the n initial terms of the sequence defined as follows: 𝑎1 = 2, 𝑎𝑘+1 = 1 + 2𝑎𝑘 for 𝑘 ≥ 2.

Task. 10.

Write a program that solves the equation 𝑎𝑥2 + 𝑏𝑥 = 1 after the user enters the numbers 𝑎 and 𝑏.

Task. 11.

Write a program for the following algorithm:


algorytm2

Task. 12.

Write a program for the following algorithm:


algorytm2

Task. 13.

Write a program/algorithm that sums the numbers entered by the user until the user enters 0, and then prints the resulting sum and the number of numbers entered (including zero/non-zero).

Task. 14.

Write a program/algorithm that prints all the divisors of the number entered by the user.

Task. 15.

Write a program/algorithm to calculate the least common divisor.

Task. 16.

Write a program/algorithm to calculate the greatest common divisor.

Task. 17.

Write a program/algorithm to calculate the least common multiple.

Task. 18.

Write a program/algorithm that finds all prime factors of a given number

Task. 19.

Twin numbers are two prime numbers 𝑝 and 𝑞 such that 𝑞=𝑝+2. Write a program/algorithm that finds the first 20 pairs of twin numbers.

Task. 20.

Write a program/algorithm that finds the five smallest natural numbers 𝑛, such that the number 𝑛2−1 is the product of three different prime numbers.

Task. 21.

Write a program/algorithm that checks whether two given numbers are prime.

Task. 22.

Write a program/algorithm that calculates the sum of the digits of a given natural number.

Task. 23.

A 𝑛-digit Armstrong number is a natural number equal to the sum of the 𝑛-th powers of its digits. Write a program/algorithm that calculates all two-digit (𝑘-digit) Armstrong numbers.

Task. 24.

Write a program/algorithm that determines the area of ​​a rectangle with a given