using System;
using [Link];
class program
{
static void Main(string[] args)
{
[Link]("Targil logic prject");
bool A = true;
bool B = true;
bool C = true;
for (int i = 0; i < 4; i++)
{
[Link]("==========================================================");
[Link](" - Targil {0} -
", i +1);
[Link]();
[Link]("Enter the binary value for the first input:");
int num1 = [Link]([Link]());
while (true)
{
if (num1 == 0)
{
A = false;
break;
}
else if (num1 == 1)
{
A = true;
break;
}
[Link]("Your answer is ineligible. What's the right value?
");
num1 = [Link]([Link]());
}
[Link]("Enter the binary value for the second input:");
int num2 = [Link]([Link]());
while (true)
{
if (num2 == 0)
{
B = false;
break;
}
else if (num2 == 1)
{
B = true;
break;
}
[Link]("Your answer is ineligible. What's the right value?
");
num2 = [Link]([Link]());
}
[Link]("Enter the binary value for the third input:");
int num3 = [Link]([Link]());
while (true)
{
if (num3 == 0)
{
C = false;
break;
}
else if (num3 == 1)
{
C = true;
break;
}
[Link]("Your answer is ineligible. What's the right value?
");
num3 = [Link]([Link]());
}
if (i == 0)
{
[Link](targil1(A, B, C));
[Link]();
}
else if (i == 1)
{
[Link](targil2(A, B, C));
[Link]();
}
else if (i == 2)
{
[Link](targil3(A, B, C));
[Link]();
}
else
{
targil4(A, B, C);
[Link]();
}
}
public static bool targil1(bool a, bool b, bool c)
{
if (((a && b) ||(!b || c)) == true)
{
return true;
}
else
{
return false;
}
}
public static bool targil2(bool x, bool y, bool z)
{
if ((!(x || y) && !z) || ((x || y) && z)== true)
{
return true;
}
else
{
return false;
}
}
public static bool targil3(bool s1, bool s2, bool s3)
{
bool[] arr = new bool[8];
for (int i = 0; i < [Link]; i++)
{
[Link]("Enter the value for I{0} => ", i + 1);
int num = [Link]([Link]());
if (num == 0)
{
arr[i] = false;
}
else
{
arr[i] = true;
}
}
int total = 0;
if ( s1 == true)
{
total += 1;
}
if (s2 == true)
{
total += 2;
}
if (s3 == true)
{
total += 4;
}
return arr[total];
}
static void targil4(bool a1, bool a2, bool a3)
{
int total = 0;
if (a1 == true)
{
total += 1;
}
if (a2 == true)
{
total += 2;
}
if (a3 == true)
{
total += 4;
}
[Link]("the i{0} is true", total + 1);
}
}