Posts

Showing posts with the label problem 16

Power digit sum | Project Euler | Problem #16

URL to the problem page:  https://projecteuler.net/problem=16 2¹⁵ = 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¹⁰⁰⁰? #include   <iostream> using   namespace   std ; int   main () {      const   int  k =  504 ;      int   number [k] = {  0  },  result [k] = {  0  }, carry, sum =  0 , i, a;      number [k -  1 ] =  2 ;      for  (a =  1 ; a <  1000 ; a++) {         carry =  0 ;          for  (i = k -  1 ; i >=  0 ; i--) {              result [i] =...
My photo
Ercan Tomac
instagram.com/ercantomac