I was trying to solve a competitive coding question which required building a series 7,77,777,...
, for that I wrote a code in c++
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
int series=0;
for(int i=0;i<6;i++)
{
series += (pow(10,i))*7;
}
return 0;
}
I was getting the required answer while dry-running but while running through MinGW compiler, the answer I got was 7,77,776,7776,77775,...
does this have anything to do with bit conversion? I tried running the same code in python and got the required answer.