/*This little program will ask the user to *input a 10 digit number and it will sum up the *digits in groups of two digits for each group. *The sum will be divided by 26, and 65 will be added *to the remainder then convert the sum of the last *operation into an ASCII character */ import java.util.Scanner; //to import the scanner library public class HomeWork2_1 { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); //input data through the class System.in long number; //to hold the users number //ask the user to enter a 10 digit number System.out.println("Enter a 10 digit number:"); number = keyboard.nextLong(); long firstGroup = 10; long divider = 100000000; while ((number - (firstGroup * divider)) > divider){ firstGroup++; } number = number - (firstGroup * divider); divider = divider / 100; long secondGroup = 0; while ((number - (secondGroup * divider)) > divider){ secondGroup++; } number = number - (secondGroup * divider); divider = divider / 100; long thirdGroup = 0; while ((number - (thirdGroup * divider)) > divider){ thirdGroup++; } number = number - (thirdGroup * divider); divider = divider / 100; long fourthGroup = 0; while ((number - (fourthGroup * divider)) > divider){ fourthGroup++; } number = number - (fourthGroup * divider); long fifthGroup = 0; while ((number - fifthGroup) > 0){ fifthGroup++; } long sum = firstGroup + secondGroup + thirdGroup + fourthGroup+ fifthGroup; long remainder = sum % 26; System.out.println("The ASCII character for the remainder is: " + (char)(remainder + 65)); } }