ifElse
This commit is contained in:
parent
99e528e51e
commit
ddc33e2beb
4 changed files with 72 additions and 6 deletions
10
Emne 3/ConsoleApp4/IfElse/IfElse.csproj
Normal file
10
Emne 3/ConsoleApp4/IfElse/IfElse.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>
|
34
Emne 3/ConsoleApp4/IfElse/Program.cs
Normal file
34
Emne 3/ConsoleApp4/IfElse/Program.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
namespace CompareApp
|
||||
{
|
||||
class IsEqualOr
|
||||
{
|
||||
private static int num = 10;
|
||||
private static int num2 = 10;
|
||||
private static bool IsEqual = false;
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (num == num2)
|
||||
{
|
||||
Console.WriteLine("Equal");
|
||||
IsEqual = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Not Equal");
|
||||
IsEqual = false;
|
||||
}
|
||||
|
||||
if (IsEqual)
|
||||
{
|
||||
num++;
|
||||
Console.WriteLine(num);
|
||||
}
|
||||
else
|
||||
{
|
||||
num--;
|
||||
Console.WriteLine(num);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue