Created
February 5, 2019 19:50
-
-
Save lislon/ca055fcf4d55c9feedab6f5de8417eb5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Age { | |
public static void main(String[] args) { | |
int dimaAge = 3; | |
int mishaAge = 2; | |
int vasyaAge = 1; | |
int oldest; | |
int youngest; | |
int middle; | |
if (dimaAge > mishaAge) { | |
oldest = dimaAge; | |
youngest = mishaAge; | |
} else { | |
oldest = mishaAge; | |
youngest = dimaAge; | |
} | |
if (vasyaAge > oldest) { | |
middle = oldest; | |
oldest = vasyaAge; | |
} else if (vasyaAge < youngest) { | |
middle = youngest; | |
youngest = vasyaAge; | |
} else { | |
middle = vasyaAge; | |
} | |
System.out.println("Old : " + oldest); | |
System.out.println("Young : " + youngest); | |
System.out.println("Middle : " + middle); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment