startit/Emne 3/ConsoleApp4/IfElse/Program.cs

66 lines
1.3 KiB
C#
Raw Normal View History

2024-11-14 13:29:50 +01:00
namespace CompareApp
{
class IsEqualOr
{
private static int num = 10;
private static int num2 = 10;
private static bool IsEqual = false;
static void Main(string[] args)
2024-11-14 14:08:38 +01:00
{
Compare();
UnEqual(5, 5);
IsThirty(25, 5);
}
static void Compare()
2024-11-14 13:29:50 +01:00
{
if (num == num2)
{
Console.WriteLine("Equal");
IsEqual = true;
}
else
{
Console.WriteLine("Not Equal");
IsEqual = false;
}
2024-11-14 14:08:38 +01:00
2024-11-14 13:29:50 +01:00
if (IsEqual)
{
num++;
Console.WriteLine(num);
}
else
{
num--;
Console.WriteLine(num);
}
}
2024-11-14 14:08:38 +01:00
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;
}
}
2024-11-14 13:29:50 +01:00
}
}