WAP to input a number calculate and display the sum of the cube of digits
Share
WAP to input a number calculate and display the sum of the cube of digits
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Answer:
this program is also known as armstrong number
for(i=n;i>0;i/=10)
{
d=i%10;
s=s+Math.pow(d,3);
}
Explanation:
This program is written in java where n is the number taken by the user nd s will be initialized as 0 nd d is the variable where the digits are stored