Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace übung
- {
- class Program
- {
- public static int m1(int n)
- {
- int z = 0;
- int schritte = 0;
- while (n > 1)
- {
- n /= 2;
- z++;
- schritte++;
- }
- Console.Write("Steps: " + schritte + " - ");
- return z;
- }
- public static int m2(int n)
- {
- int i = 1;
- int b = 1;
- while (i < n)
- {
- b = b + 2 * i + 1;
- i++;
- }
- return b;
- }
- public static int m3(int n)
- {
- int t = 1, z = 0;
- while (n > 0)
- {
- n = n - t;
- t = t + 2;
- z++;
- }
- return z;
- }
- public static int m4(int n)
- {
- return m3(m1(n));
- }
- public static int m5(int n)
- {
- return m2(m3(n));
- }
- public static int m6(int n)
- {
- return m3(m2(n));
- }
- public static int m7(int n)
- {
- int z = 0;
- for (int i = 1; i <= m3(n); i++)
- z = z + m3(n);
- return z;
- }
- public static int m8(int n)
- {
- int z = 0;
- int y = m3(n);
- for (int i = 1; i <= y; i++)
- z = z + m3(n);
- return z;
- }
- public static int m9(int n)
- {
- return m3(n) + m1(n);
- }
- public static int m10(int n)
- {
- return m2(m2(n));
- }
- static void werteTabelle(Func<int, int> mx, int min, int max)
- {
- for (int i = min; i <= max; i++)
- {
- Console.WriteLine("n = " + i + " - ret = " + mx(i));
- }
- }
- static void Main(string[] args)
- {
- int n = 200;
- werteTabelle(m1, 1, 60);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement