Skip to content

Instantly share code, notes, and snippets.

@greensma
Created October 28, 2016 20:06
Show Gist options
  • Save greensma/41fbf5237a2018c6ea285bd9bee5d0d6 to your computer and use it in GitHub Desktop.
Save greensma/41fbf5237a2018c6ea285bd9bee5d0d6 to your computer and use it in GitHub Desktop.
HomeWork3
public class Ex1 {
public static void main(String[] args) {
System.out.printf("Площадь %.2f",geroneSquare(14, 12, 12));
}
public static double geroneSquare(double a, double b, double c) {
double p = (a + b + c) / 2;
return Math.sqrt(p * (p - a) * (p - b) * (p - c));
}
}
package table;
public class Ex2 {
public static int[] create(int x){
int[] tablex = new int[9];
for (int i = 1; i<9; i++){
tablex[i] = x * i;
tablex[i+1] = i; //12 строка
}
return tablex;
}
}
public class Ex4 {
public static int min(int a, int b, int c) {
a = 5;
b = 3;
c = 8;
if (a < b && a < c) {
return a;
} else if (b < a && b < c) {
return b;
} else if (c < a && c < b) {
}
return c;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment