Write a c ++ program which prints the sum of the cubes of the digits of a number.
Answers
Answered by
1
well.. c++ is quite intresting ... lemme just work it out
please mark as brainliest ...
long num, temp, digit, sum = 0;
printf("Enter the number \n");
scanf("%ld", &num);
temp = num;
while (num > 0)
digit = num % 10;
sum = sum + digit;
this is for obtaining the sum of digits .... now cube the result and u get the required answer
Similar questions