Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- class CommandLineInput{
- static public void main (String[] args){
- int no = Integer.parseInt(args[0]);
- int sum = 0;
- while(no != 0){
- int remainder = no % 10;
- sum += remainder * remainder * remainder;
- no /= 10;
- }
- System.out.print("Sum of cube of individual digits = "+sum);
- }
- }
- // Output:-
- // C:\Java>java CommandLineInput 23
- // Sum of cube of individual digits = 35
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement