E06 Random 1 bis 6

E07 DateTime 1 bis 7
E08 IF Ex 1 bis 9
Tuple Aufgaben verschoben
This commit is contained in:
2023-10-05 15:45:58 +02:00
parent 7cb053ad94
commit c5c2681cab
34 changed files with 609 additions and 73 deletions

19
E06_Random/Exercise_1.cs Normal file
View File

@@ -0,0 +1,19 @@
using System;
using System.IO;
using System.Collections.Generic;
namespace Exercises_C_Sharp.E06_Random
{
class Exercise_1
{
public static void Start()
{
//Sorgen Sie dafür, dass eine Zufallszahl auf der Konsole ausgegeben wird.
int i;
//Code START
i = -1;
//Code ENDE
Console.WriteLine(i);
}
}
}

19
E06_Random/Exercise_2.cs Normal file
View File

@@ -0,0 +1,19 @@
using System;
using System.IO;
using System.Collections.Generic;
namespace Exercises_C_Sharp.E06_Random
{
class Exercise_2
{
public static void Start()
{
//Sorgen Sie dafür, dass eine Zufallszahl zwischen 1 und 10 ausgegeben wird.
int i;
//Code START
i = -1;
//Code ENDE
Console.WriteLine(i);
}
}
}

22
E06_Random/Exercise_3.cs Normal file
View File

@@ -0,0 +1,22 @@
using System;
using System.IO;
using System.Collections.Generic;
namespace Exercises_C_Sharp.E06_Random
{
class Exercise_3
{
public static void Start()
{
//Sorgen Sie dafür, dass eine Zufallszahl zwischen 0 und 45 ausgegeben wird.
Random rand = new Random();
int k;
//Code START
k = -1;
//Code ENDE
Console.WriteLine(rand.Next() % k);
}
}
}

22
E06_Random/Exercise_4.cs Normal file
View File

@@ -0,0 +1,22 @@
using System;
using System.IO;
using System.Collections.Generic;
namespace Exercises_C_Sharp.E06_Random
{
class Exercise_4
{
public static void Start()
{
//Sorgen Sie dafür, dass eine negative Zahl zwischen -120 und -10 auf der Konsole ausgegeben wird.
int i;
//Code START
i = -1;
//Code ENDE
Console.WriteLine(i);
}
}
}

23
E06_Random/Exercise_5.cs Normal file
View File

@@ -0,0 +1,23 @@
using System;
using System.IO;
using System.Collections.Generic;
namespace Exercises_C_Sharp.E06_Random
{
class Exercise_5
{
public static void Start()
{
//Sorgen Sie dafür, dass immer drei verschiedene Zufallszahlen ausgegeben werden.
int[] intArray = new int[3];
//Code START
//Code ENDE
Console.WriteLine("Zahl 1: " + intArray[0]);
Console.WriteLine("Zahl 2: " + intArray[1]);
Console.WriteLine("Zahl 3: " + intArray[2]);
}
}
}

22
E06_Random/Exercise_6.cs Normal file
View File

@@ -0,0 +1,22 @@
using System;
using System.IO;
using System.Collections.Generic;
namespace Exercises_C_Sharp.E06_Random
{
class Exercise_6
{
public static void Start()
{
//Generieren Sie zufällig ein Wort mit 5 Zeichen. Der erste Buchstabe sollte groß geschrieben sein. (Tipp: Buchstaben sind auch nur Zahlen)
string s = string.Empty;
//Code START
//Code ENDE
Console.WriteLine("Das neue Wort ist \"{0}\".", s);
}
}
}