package de.codegym.task.task04.task0424;
/*
Drei Zahlen
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader eingabe = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(eingabe.readLine());
int b = Integer.parseInt(eingabe.readLine());
int c = Integer.parseInt(eingabe.readLine());
if (a==b && a != c){
System.out.println(c);
}
else if (a==c&& a != b){
System.out.println("b");
}
else if (b==c&& b!=a){
System.out.println(a);
}
}
}
Code does not match the requirements
In der Diskussion
Kommentare (6)
- Beliebt
- Neu
- Alt
Du musst angemeldet sein, um einen Kommentar schreiben zu können
Christophsnz
23 August 2021, 12:05
ich kann dir leider nicht ganz folgen ^^
0
Thomas
23 August 2021, 12:42
you could try smth. like that
+1
Christophsnz
23 August 2021, 11:26
Thank you Thomas, but my Code doesnt meet the requirements so far - any hints?
0
Thomas
23 August 2021, 11:52
yes, you need to output the ordinal, not "b" or the value of some variable. The ordinal of the first number you enter is 1, for the second it is 2 and so on. Something similar to an index.
+1
Christophsnz
23 August 2021, 07:59
Why do I need a comparison for not equal?
0
Thomas
23 August 2021, 08:46
cause of the fourth requirement:
• If all the numbers are different, don't display anything.
if you just check for eg. a == b then c could be equal to a and b as well but you'd output c's index as ordinal
+1