So i need to add a sum of digits from 1 to 1000. for example: if u add the digits in 468 you get 4+6+8 = 18 and the squared and cube of the digit = 18 also. i have to output a list of positive integers (k,k2,k3) to add up to same number. I have written down in pseudocode but i need help with making it into an actual program.
//for n = 1 to 1000 {
// nsquared = n * n;
// ncubed = n * n * n;
// convert n to string array (atoi)
// convert nsquared to string array (atoi)
// convert ncubed to sting array (atoi)
// sumofdigits = 0;
// for each digit in n's array {
// copy digit to array of size 2 with second character being '\0'
// convert digit array to integer
// add integer to sumofdigits
theres another separate loop for nsquared and ncubed
//if(sumofdigits == sumofnsdigits == sumofncdigits) {
// print n