Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main2 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int a = scanner.nextInt();
- int b = scanner.nextInt();
- int c = scanner.nextInt();
- if (a<b&&a<c){
- if (b<c) System.out.printf("%d,%d,%d\n",a,b,c);
- else System.out.printf("%d,%d,%d\n",a,c,b);
- }else if (b<a&&b<c){
- if (a<c) System.out.printf("%d,%d,%d\n",b,a,c);
- else System.out.printf("%d,%d,%d\n",b,c,a);
- }else {
- if (a<b) System.out.printf("%d,%d,%d\n",c,a,b);
- else System.out.printf("%d,%d,%d\n",c,b,a);
- }
- /*
- Atau cara yang lain
- */
- // int tmp;
- // if (a > b) {
- // tmp = a;
- // a = b;
- // b = tmp;
- // }
- // if (a > c) {
- // tmp = a;
- // a = c;
- // c = tmp;
- // }
- // if (b > c) {
- // tmp = b;
- // b = c;
- // c = tmp;
- // }
- // System.out.printf("%d,%d,%d",a,b,c);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement