Write a program that takes a five digit number and find the sum of the cube of the digits.. please fast I need it urgently
Answers
Answered by
1
Answer:
import java.util.*;
class Sum
{
void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter 5 digit number");
int num=sc.nextInt();
int cub=0,sum=0;
int copy=num;
for(int n=0;n<5;n++,copy=copy/10)
{
int k=copy%10;
cub=k*k*k;
sum=sum+cub;
}
System.out.println("Sum of qubic digit is:"+sum);
}
}
Please mark me as brainliest..
Answered by
26
Here is your answer.......
Attachments:
![](https://hi-static.z-dn.net/files/d90/75c9e421ebe5200c64da57c811ce92a8.jpg)
Similar questions