Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. int i;
  2.        
  3. for (i = 10; i <= 35; i++) {
  4.     String str = String.valueOf(i);
  5.        
  6.     int firstInt = Integer.parseInt(str.substring(0, 1));
  7.     int secondInt = Integer.parseInt(str.substring(1, str.length()));
  8.            
  9.     String first = (firstInt % 2 == 0) ? "Even" : "Odd";
  10.     String second = (secondInt % 2 == 0) ? "Even" : "Odd";
  11.            
  12.     print("Number is " + i + " and the first number " + firstInt + " is " + first + " and the second number " + secondInt + " is " + second);
  13.            
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement