Модуль: (C++) Loop statement with condition - while


Задача

7/21

Digits of the number - 2 - answer the question

Задача

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";
}

Выберите правильный ответ, либо введите его в поле ввода

Комментарий учителя