Untitled
unknown
plain_text
a year ago
977 B
2
Indexable
Never
// Online Java Compiler // Use this editor to write, compile and run your Java code online import java.util.*; class HelloWorld { public static void main(String[] args) { int sum = 0; Scanner input = new Scanner(System.in); System.out.print("Enter an int between 0 and 1000: "); int number = input.nextInt(); System.out.println("You entered: " + number); System.out.println("Last digit = "+number % 2); sum+= number % 2; System.out.println("Sum = " + sum); number /= 10; System.out.println("Number is now: " + number); System.out.println("Last digit = "+number % 2); sum+= number % 2; System.out.println("Sum = " + sum); number /= 10; System.out.println("Number is now: " + number); System.out.println("Last digit = "+number % 2); sum+= number % 2; System.out.println("Sum = " + sum); } }