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:
Similar questions
Computer Science,
6 months ago
Computer Science,
6 months ago
Physics,
6 months ago
Biology,
1 year ago
Physics,
1 year ago
Political Science,
1 year ago
Math,
1 year ago