Loop statement with condition - while




ЗАДАЧА
Analyze the previous task and answer the question:
What is the value of the variable n after the end of the program?

Программа:
#include<iostream>
using namespace std;
main()
{
int n, count;
cin >> n;
count = 0;
while (n != 0) 
  {
  count ++;
  n = n / 10;
  }
cout << "Number - " <<n<< " contains " << count << " digits";
}

Ответ:

     
Результаты проверки: