If i put "cout<<a<<"\n";" in the penultimate line instead of "cout<<n<<"\n";", this code prints out 0. Can someone explain why is that so because I hardly get it?
#include <iostream>
#include <cstdlib>
using namespace std;
int main ()
{
int a=123456;
int n=0;
for (; a>0 ;)
{
a=a/10;
n++;
}
cout<<n<<"\n";
}