using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Übungen_LF6_WinFormanwendung { class class_übungen { public static void main() { int temp = 0; temp = qsum(1234); Console.WriteLine("Quersumme: " + temp); Console.ReadLine(); } public static double max2(double a, double b) { double max = 0; if (a > b) max = a; else max = b; return max; } public static double max3(double a, double b, double c) { double max = 0; max = max2(a, b); max = max2(max, c); return max; } public bool istTeilerVon(int x, int d) { bool teilbar = false; try { if (x % d == 0) teilbar = true; else teilbar = false; return teilbar; } catch (Exception) { return false; } } public int qsum(int i) { string pufferlaenge = i.ToString(); int querSumme = 0; int laenge = pufferlaenge.Length; for (int count = laenge-1; count >= 0; count--) querSumme += Convert.ToInt32(pufferlaenge.Substring(count,1)); return querSumme; } public bool istPrim(int i) { bool prim = false; int countDivisions = 0; for (int counter = 1; counter == i; counter++) { if (i % counter == 0) countDivisions++; } if (countDivisions <= 2) prim = true; else prim = false; return prim; } public int euclid_old(int a, int b) { if (a == 0) return b; else while (b != 0) { if (a > b) a = a - b; else b = b - a; } return a; } } } }