RND
This commit is contained in:
parent
ddc33e2beb
commit
95d3a2be13
|
@ -6,6 +6,13 @@
|
|||
private static int num2 = 10;
|
||||
private static bool IsEqual = false;
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Compare();
|
||||
UnEqual(5, 5);
|
||||
IsThirty(25, 5);
|
||||
}
|
||||
|
||||
static void Compare()
|
||||
{
|
||||
if (num == num2)
|
||||
{
|
||||
|
@ -29,6 +36,30 @@
|
|||
Console.WriteLine(num);
|
||||
}
|
||||
}
|
||||
|
||||
static int UnEqual(int num1, int num2)
|
||||
{
|
||||
if (num1 != num2)
|
||||
{
|
||||
return num1 + num2;
|
||||
}
|
||||
else
|
||||
{
|
||||
return num1 * num2;
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsThirty(int num, int num2)
|
||||
{
|
||||
if (num + num2 == 30)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
16
Emne 3/ConsoleApp5/ConsoleApp5.sln
Normal file
16
Emne 3/ConsoleApp5/ConsoleApp5.sln
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Random", "Random\Random.csproj", "{94A6C03C-25AE-4D33-97EB-E732F895D396}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{94A6C03C-25AE-4D33-97EB-E732F895D396}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{94A6C03C-25AE-4D33-97EB-E732F895D396}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{94A6C03C-25AE-4D33-97EB-E732F895D396}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{94A6C03C-25AE-4D33-97EB-E732F895D396}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
24
Emne 3/ConsoleApp5/Random/Program.cs
Normal file
24
Emne 3/ConsoleApp5/Random/Program.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
namespace Random
|
||||
{
|
||||
class Random
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
System.Random rnd = new System.Random();
|
||||
int randomnr = rnd.Next(0, 3);
|
||||
if (randomnr == 0)
|
||||
{
|
||||
Console.WriteLine("Tallet ble 0");
|
||||
}else if (randomnr == 1)
|
||||
{
|
||||
Console.WriteLine("Tallet ble 1");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Tallet ble 2");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
10
Emne 3/ConsoleApp5/Random/Random.csproj
Normal file
10
Emne 3/ConsoleApp5/Random/Random.csproj
Normal file
|
@ -0,0 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in a new issue