Find the greatest of three numbers
Firat BMunknown
java
2 years ago
1.1 kB
38
Indexable
public class ebBul { public static void main(String[] args) { int a,b,c; int s1 = 0,s2 = 0,s3 = 0; Scanner k = new Scanner(System.in); a = k.nextInt(); b = k.nextInt(); c = k.nextInt(); if(a>=b && a>=c) { s1=a; if(b>c) { s2=b; s3=c; } else{ s2=c; s3=b; } } if(b>=a && b>=c){ s1=b; if(a>c) { s2=a; s3=c; } else{ s2=c; s3=a; } } else { s1=c; if(a>b) { s2=a; s3=b; } else{ s2=b; s3=a; } } System.out.println("1. sayı: "+s1+"\n2. sayı: "+s2+"\n3. sayı: "+s3); } }
Editor is loading...