Skip to content

Instantly share code, notes, and snippets.

@HydrolienF
Created May 26, 2021 15:44
Show Gist options
  • Save HydrolienF/f3d0fda045acda4ad4a5fc6a94d38194 to your computer and use it in GitHub Desktop.
Save HydrolienF/f3d0fda045acda4ad4a5fc6a94d38194 to your computer and use it in GitHub Desktop.
// sans if, else, ?, for, while, switch faire une fonction qui affiche 0 si elle recois 0 et 1 à l'infini sinon.
class defiDeLygaen{
public static void main(String[] args) {
f2(0);
f2(1);
}
private static void f2(int x){
try {
System.out.println(1/x);
try {
Thread.sleep(100);
} catch (InterruptedException ie) {}
f2(x);
}catch (Exception e) {
System.out.println("0");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment