Skip to content

Instantly share code, notes, and snippets.

@nherbaut
Created September 12, 2023 13:02
Show Gist options
  • Select an option

  • Save nherbaut/854826874a588fb41e3bcbc6feafc03f to your computer and use it in GitHub Desktop.

Select an option

Save nherbaut/854826874a588fb41e3bcbc6feafc03f to your computer and use it in GitHub Desktop.
L2.1.5 Les fonctions

Essayez de calculer le résulat de l'appel de g avant d'exécuter le code

public class TypesL2 {
static int myFunction(int x, int y) {
int z = 2 * x - y;
return z * x;
}
static int f(int n) {
return 3 + myFunction(n, n + 1);
}
static int g() {
int a;
a = myFunction(3, 7);
int b = f(a * a);
return b;
}
public static void main(String... args) {
int returnValue = g();
System.out.println(returnValue);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment