Skip to content

Instantly share code, notes, and snippets.

@smyy96
Created January 21, 2022 00:27
Show Gist options
  • Save smyy96/ba89edbf76b602b02bb0361877e4c640 to your computer and use it in GitHub Desktop.
Save smyy96/ba89edbf76b602b02bb0361877e4c640 to your computer and use it in GitHub Desktop.
Patika Java 101 - Sayıları Büyükten Küçüğe Sıralama
import java.util.Scanner;
public class büyüksayi {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int sayi1, sayi2, sayi3, enbuyuk;
System.out.print("1.Sayı: ");
sayi1 = input.nextInt();
System.out.print("2.Sayı: ");
sayi2 = input.nextInt();
System.out.print("3.Sayı: ");
sayi3 = input.nextInt();
if (sayi1 > sayi2 && sayi1 > sayi3) {
if (sayi2 > sayi3)
System.out.print(sayi1 + ">" + sayi2 + ">" + sayi3);
else
System.out.print(sayi1 + ">" + sayi3 + ">" + sayi2);
}
if (sayi2 > sayi1 && sayi2 > sayi3) {
if (sayi1 > sayi3)
System.out.print(sayi2 + ">" + sayi1 + ">" + sayi3);
else
System.out.print(sayi2 + ">" + sayi3 + ">" + sayi1);
}
if (sayi3 > sayi2 && sayi3 > sayi1) {
if (sayi1 > sayi2)
System.out.print(sayi3 + ">" + sayi1 + ">" + sayi2);
else
System.out.print(sayi3 + ">" + sayi1 + ">" + sayi2);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment