Computer Science, asked by Zainab1210hassan, 10 months ago

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 Vyomsingh
1

Answer:

Hello friend.

.......................................................

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);

}

}

Explanation:

Answered by anindyaadhikari13
22

Here is your answer...........

Attachments:
Similar questions