I'm new to JAVA, stuck on "int"...Need some help getting this stuff straight, thanks!
Asks the user to enter a 5 digit positive integer
Calculate each digit using integer operations / and %.
Calculate and display the sum of the digits.
Heres what I got so far:
* Testing Digits Program
* This is my work
public class Digits
public static void main (String  args)
Scanner keyboard = new Scanner (System.in);
System.out.println("Enter a 5 digit number:");
String digits = keyboard.nextLine();
fi = (x/10000);
se = (x%1000)/1000;
th = (x%100)/100;
I've got this far then i get errors left and right...and I'm looking for a similar question like it in the book and can't seem to find one. And this % is new to me I think I'm using it wrong so i left fr (fourth) and ft (fifth) . For example if i place 12345 i want the program to sum 1+2+3+4+5 which equals displaying 15...Thanks,, any contribution appreciated thanks.