Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Console.Write("Bitte geben Sie die Anzahl der Zeilen der Pyramide ein: ");
- int zeilen = Convert.ToInt32(Console.ReadLine());
- string raute = "#";
- string stern = "*";
- int anzahlzeichen = -1;
- double hilfsvariable = 1;
- while(zeilen > 0)
- {
- anzahlzeichen += 2;
- int x = anzahlzeichen;
- while(x > 0)
- {
- if (hilfsvariable%2 == 0)
- {
- Console.Write("{0}", stern);
- x--;
- }
- else
- {
- Console.Write("{0}", raute);
- x--;
- }
- }
- hilfsvariable += 1;
- Console.WriteLine();
- zeilen--;
- }
- string str = "Hello";
- Console.SetCursorPosition((Console.WindowWidth - str.Length) / 2, Console.CursorTop);
- Console.WriteLine(str);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement