package pl.codegym.task.task04.task0412;
/*
Liczby dodatnie i ujemne
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws Exception {
//tutaj wpisz swój kod
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int a = reader.parseInt();
if (a > 0) {
System.out.println(2*a);
} else if (a < 0) {
System.out.println(a++);
} else {
System.out.println(0);
}
}
}
Ktoś ma pomysł co może być nie tak z 13 linijką?
Dyskutowane
Komentarze (2)
- Popularne
- Najnowsze
- Najstarsze
Musisz się zalogować, aby dodać komentarz
Krzysztof Skorupka
27 grudnia 2022, 12:45przydatny
powinno być w 13 tej linni : int a = reader.readLine();
+1
Thomas
26 grudnia 2022, 08:48
The BufferedReader class does not define a method parseInt (neither static nor instance). You probably intended to use the Integer class' method parseInt.
+1