/** * Beschreiben Sie hier die Klasse AB_2_3. * * @author (Ihr Name) * @version (eine Versionsnummer oder ein Datum) */ public class AB_2_3 { public static void linear(float m, float c) { if (m == 0) { if (c == 0) System.out.println("Unendlich viele Nullstellen"); else System.out.println("keine Nullstelle"); return; } float x= - c / m; System.out.println("Nullstelle: ("+x+"|0)"); } public static void quadrat(float a, float b, float c) { float D = b*b - 4*a*c; if (D < 0) System.out.println("keine Nullstellen"); double x1 = (-b + Math.sqrt(D))/(2*a); double x2 = (-b - Math.sqrt(D))/(2*a); if (D == 0) System.out.println("eine Nullstellen bei ("+x1+"|0)"); else System.out.println("Nullstellen bei ("+x1+"|0) und ("+x2+"|0)"); } public static int glaeser(int n) { int sum = 0; for(int i=2; i<=n; i++) { sum += i*(i-1)/2; } return sum; } }