Skip to content

Instantly share code, notes, and snippets.

@uncoded-ro
Created January 12, 2020 14:03
Show Gist options
  • Save uncoded-ro/7a67fc2fec307aebbc5ba13a3672f625 to your computer and use it in GitHub Desktop.
Save uncoded-ro/7a67fc2fec307aebbc5ba13a3672f625 to your computer and use it in GitHub Desktop.
class Conditie {
public static void main(String[] args) {
// instructiunea if
int min;
int a = 15, b = 3, c = 23;
if (a < b) {
if (a < c)
min = a;
else
min = c;
} else {
if (b < c)
min = b;
else
min = c;
}
System.out.println("minimul este " + min);
// instructiunea switch
int luna = 5;
switch (luna) {
case 1:
case 2:
case 12:
System.out.println("iarna");
break;
case 3:
case 4:
case 5:
System.out.println("primavara");
break;
case 6:
case 7:
case 8:
System.out.println("vara");
break;
case 9:
case 10:
case 11:
System.out.println("toamna");
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment