pcp - num = Console.nextInt(); System.out.println(); num =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.io.*; import java.text.*; import java.util.Scanner; import java.lang.*; import java.math.*; import java.lang.String; import java.io.*; public class pcp { public static void main(String[] args)throws FileNotFoundException, IOException { int num,sum,num2; Scanner Console = new Scanner(System.in); System.out.println("Please Enter a positive Interger");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: num = Console.nextInt(); System.out.println(); num = Math.abs(num); num2 = num; sum = 0; do { num2 = (num % 10); System.out.print(num2); sum = sum + num2; num = (num / 10); num2 = (num % 10); n } while (num > 0); System.out.println(); System.out.println(sum); } }...
View Full Document

Ask a homework question - tutors are online