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;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Aufgabe eingeben:");
- int x = Convert.ToInt32(Console.ReadLine());
- switch (x)
- {
- case 1: A1(); break;
- case 2: A2(); break;
- case 3: A3(); break;
- case 4: A4(); break;
- }
- }
- static public void A1()
- {
- int x = 0;
- int erg = 0;
- while (x < 100)
- {
- x = x + 1;
- erg += x;
- }
- Console.WriteLine("Ergebnis für A1: "+erg);
- }
- static public void A2()
- {
- long erg = 1;
- long y = 0;
- for (y=1;y < 14; y++)
- {
- erg *= y;
- }
- Console.WriteLine("Ergebnis für A2: " + erg);
- }
- static public void A3()
- {
- float erg = 0;
- float y = 0;
- for (y = 2; y < 101; y++)
- {
- erg += 1/y;
- //Console.WriteLine("Ergebnis für " +y+ " \t"+ erg);
- }
- Console.WriteLine("Ergebnis für A3: " + erg);
- }
- static public void A4()
- {
- double kap = 1000;
- double zins = 5;
- double jahre = 7;
- double erg = kap * Math.Pow((1 + (zins / 100)), jahre);
- Console.WriteLine("Ergebnis für A4: " + erg);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment