Computer Science, asked by soundryarani45555, 11 months ago

Write a program which prints the sum of the cubes of the digits of
a number.

Answers

Answered by karanjotgaidu
3

Answer :

#python program to print the sum of the cubes of #a number

N = int(input("Enter the number"))

S = 0

while N>0:

D = N%10

S+= D**3

N//=10

print("Sum of cubes of the digits=", S)

Answered by marishthangaraj
1

Program which prints the sum of the cubes of the digits of  a number.

​#include<iostream.h>

#include<conio.h>

void main()

{  

clrscr();

// varialble declaration

int a,cube,sum=0,r;

//getting the input

cout<<"\nEnter the number: ";

cin>>a;

while(a>0)

{

// Finding the sum of digits of number by using modulo

r=a%10;

cube=r*r*r;

sum+= cube;

a/=10;

}

// printing out the result

cout<<"\nThe cube sum of individual digits is: "<<sum;

getch();

}

Output:

Enter the number:111

The cube sum of individual digits is:3

Learn more about the sum of digits:

A three digit number is called an Armstrong number if the sum of the cube of its digits is equal to the number itself. Write an algorithm for the same.

https://brainly.in/question/11323009

write a program to print sum of cubes of odd numbers between 1 and 10

https://brainly.in/question/8179703

Similar questions