0

#include<iostream>

#include<fstream>

#include<cmath>

#include<iomanip>

using namespace std;

/*

215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.

What is the sum of the digits of the number 2^1000?

*/

//my logic is to export 2^1000 into a text file. Then import it into an array and the add them. but it seems to be not working as planned. any help people?

```
int main(){
ofstream Ofile("num.txt");
unsigned long double two = 2.0;
unsigned long double oneTh = 1000.0;
unsigned long double result = pow(two,oneTh);
Ofile << setprecision(1000000)<<result;
//cout<< setprecision(1000000)<<result;
__int64 arry[50000]= {0};
for(int i=0;(i<50000 && (!Ofile.eof())) ; i++ )
{
Ofile << arry;
if(arry[i]<1 && (arry[i+1] && arry[i+2] == 0) ) // if a sequence of 0 starts comming break;
break;
cout<<arry[i];
}
return 0;
}
```