Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions 1. Hra/1. Hra.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>_1._Hra</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
2 changes: 2 additions & 0 deletions 1. Hra/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
317 changes: 259 additions & 58 deletions AppsLab.CSharp.Exercises.sln

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions Example switch/Example switch.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>Example_switch</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
14 changes: 14 additions & 0 deletions Example switch/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// See https://aka.ms/new-console-template for more information



int number = 3;

string numberDescription = number switch
{
1 => "jeden",
2 => "dva",
3 => "tri",
_ => "nezname cislo",
};
Console.WriteLine(numberDescription); // vypise: tri
10 changes: 10 additions & 0 deletions Foreach/Foreach.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
2 changes: 2 additions & 0 deletions Foreach/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
25 changes: 25 additions & 0 deletions IDK/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// See https://aka.ms/new-console-template for more information
using System.Runtime.ExceptionServices;
using System.Security.Cryptography;



for (int i = 1; i <= 1000; i++)
{
int modulo = i % 2;
if (modulo == 0)
{
Console.WriteLine(i);
}
}


/*
int u = 1;

while (u <= 1000)
{
Console.WriteLine(u);
u++;
}
*/
10 changes: 10 additions & 0 deletions IDK/Vypisovanie cisel.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
11 changes: 11 additions & 0 deletions Kalkulacka switch/Kalkulacka switch.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>Kalkulacka_switch</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
38 changes: 38 additions & 0 deletions Kalkulacka switch/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// See https://aka.ms/new-console-template for more information

Console.WriteLine("vyber si prve cislo");
string? number1Text = Console.ReadLine();
decimal number1 = decimal.Parse(number1Text);

Console.WriteLine("+, -, /, *, %");
string? znamienko = Console.ReadLine();

Console.WriteLine("vyber si druhe cislo");
string? number2Text = Console.ReadLine();
decimal number2 = decimal.Parse(number2Text);



switch (znamienko)
{
case "+":
Console.WriteLine(number1 + number2);
break;
case "-":
Console.WriteLine(number1 - number2);
break;
case "*":
Console.WriteLine(number1 * number2);
break;
case "/":
if (number2 == 0)
{
Console.WriteLine("Chyba: nemozes delit nulou");
break;
}
Console.WriteLine(number1 / number2);
break;
case "%":
Console.WriteLine(number1 % number2);
break;
}
10 changes: 10 additions & 0 deletions Kalkulacka/Kalkulacka.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
40 changes: 40 additions & 0 deletions Kalkulacka/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// See https://aka.ms/new-console-template for more information


Console.WriteLine("vyber si prve cislo");
string? number1Text = Console.ReadLine();
decimal number1 = decimal.Parse(number1Text);

Console.WriteLine("+, -, /, *, %");
string? znamienko = Console.ReadLine();

Console.WriteLine("vyber si druhe cislo");
string? number2Text = Console.ReadLine();
decimal number2 = decimal.Parse(number2Text);


if (znamienko == "+")
{
decimal sucet = number1 + number2;
Console.WriteLine("Je to " + sucet);
}
else if (znamienko == "-")
{
decimal rozdiel = number1 - number2;
Console.WriteLine("Je to " + rozdiel);
}
else if (znamienko == "*")
{
decimal sucin = number1 * number2;
Console.WriteLine("Je to " + sucin);
}
else if (znamienko == "/")
{
decimal podiel = number1 / number2;
Console.WriteLine("Je to " + podiel);
}
else if (znamienko == "%")
{
decimal idk = number1 % number2;
Console.WriteLine("Je to " + idk);
}
11 changes: 11 additions & 0 deletions Name and age/Name and age.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>Name_and_age</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
9 changes: 9 additions & 0 deletions Name and age/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// See https://aka.ms/new-console-template for more information

Console.WriteLine("Name?");
string? name = Console.ReadLine();

Console.WriteLine("Age?");
string? age = Console.ReadLine();

Console.WriteLine($"Ahoj {name}. Tvoj vek je {age}");
30 changes: 30 additions & 0 deletions Projekt bool/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// See https://aka.ms/new-console-template for more information
/*bool a = true;
int b = 74;
int c = 42;

bool andBool1 = a && (b > c);
bool andBool2 = a && (b == c);
bool andBool3 = a && (b == c) || (c < b); */

/*bool a = true;
int b = 11;
int c = 9;
bool d = true;
int e = 11;


bool vysledok = ((c <= b) || !a) && (a == (e == b));
int o = 5; */



bool a = false;
int b = 8;
int c = 10;
bool d = false;
int e = 11;

bool vzsledok = (!(a && d) || (!(b < e) && !vysledok));

int x = 5;
11 changes: 11 additions & 0 deletions Projekt bool/Projekt bool.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>Projekt_bool</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
61 changes: 61 additions & 0 deletions Projekt if, else/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// See https://aka.ms/new-console-template for more information
/*
Console.WriteLine("Type a number 1-6");
string s = Console.ReadLine();
int number = int.Parse(s);

if (number >= 1 && number <= 5)
{
Console.WriteLine("hura mas kocku");
}
else if( number == 6 )
{
Console.WriteLine("ides este raz");
}
else
{
Console.WriteLine("Nemas kocku :(");
} */




//nacitam prve cislo
//nacitam operaciu(+, -, /, *)
//nacitam druhe cislo
//vykonam operaciu
//vypisem vysledok


Console.WriteLine("vyber si prve cislo");
string? number1Text = Console.ReadLine();
decimal number1 = decimal.Parse(number1Text);

Console.WriteLine("+, -, /, *");
string? znamienko = Console.ReadLine();

Console.WriteLine("vyber si druhe cislo");
string? number2Text = Console.ReadLine();
decimal number2 = decimal.Parse(number2Text);


if (znamienko == "+")
{
decimal sucet = number1 + number2;
Console.WriteLine("Je to " + sucet);
}
else if (znamienko == "-")
{
decimal rozdiel = number1 - number2;
Console.WriteLine("Je to " + rozdiel);
}
else if (znamienko == "*")
{
decimal sucin = number1 * number2;
Console.WriteLine("Je to " + sucin);
}
else if (znamienko == "/")
{
decimal podiel = number1 / number2;
Console.WriteLine("Je to " + podiel);
}
11 changes: 11 additions & 0 deletions Projekt if, else/Projekt if, else.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>Projekt_if__else</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
16 changes: 16 additions & 0 deletions Projekt random/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// See https://aka.ms/new-console-template for more information
int a = 5;
int b = 3;

int sum = a + b; // 8
int difference = a - b; // 2
int product = a * b; // 15
decimal division = a / (decimal)b; // 1.66666666666667
int remainder = a % b; // 2

bool equality = a == b; // false
bool inequality = a != b; // true
bool greater = a > b; // true
bool lesser = a < b; // false
bool greaterEqual = a >= b; // true
bool lesserEqual = a <= b; // false
11 changes: 11 additions & 0 deletions Projekt random/Projekt operacie.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>Projekt_random</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
2 changes: 2 additions & 0 deletions Random/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// See https://aka.ms/new-console-template for more information

10 changes: 10 additions & 0 deletions Random/Random.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
10 changes: 10 additions & 0 deletions Scitanie cisel/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// See https://aka.ms/new-console-template for more information

int[] numbers = new int[10] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 54 };
int vysledok = 0;

for (int i = 0; i < numbers.Length; i++)
{
vysledok += numbers[i];
}
Console.WriteLine(vysledok);
Loading