Given a natural number A. Find the sum of the digits of the given number belonging to the interval (2; 7).

Answer: C ++ program #include <iostream> using namespace std; int main () {int a, k; int sum = 0; cout “” Enter number: “; cin “a; while (a) {k = a% 10; if (k> 2 && k <7) sum = sum + k; a = a / 10; } cout “” Result: “” sum “endl; return 0; } To find all the digits of a natural number, it is necessary to implement a cycle of finding the remainder from division by 10 until the number is less than 10. Also, each time it is necessary to check whether the digit is in the range specified in the condition. And if it is included, then add it to the total.



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.