Rikk
Rikk
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
$close
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
yessir
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
HmmCouncilRTX5
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
learnt alot today!
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
Thanks for the help guys, it means a lot
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
Well, gonna go get some sleep now.
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
Yeah true
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
I hated how stupid it is to create an UI and executable
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
float result = (operand1 / operand2);
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
I guess it's similar here
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
Yeah I've used float in python before
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
class Program
{

static void Main(string[] args)
{
Console.WriteLine("Enter the problem.\nInclude spaces in between for correct functioning.");
string Problem = Console.ReadLine();

string[] component = Problem.Split(' ');
int operand1 = int.Parse(component[0]);
string operation = (component[1]);
int operand2 = int.Parse(component[2]);
int result = 0;

if (operation == "+")
{
result = Addition(operand1, operand2);
}

else if (operation == "*")
{
result = Product(operand1, operand2);
}
else if (operation == "-")
{
result = Subtraction(operand1, operand2);
}
else if (operation == "/")
{
result = Division(operand1, operand2);
}

Console.WriteLine("Your Result is" + result);
}

static int Addition(int operand1, int operand2)
{
return (operand1 + operand2);
}
static int Product(int operand1, int operand2)
{
return (operand1 * operand2);
}
static int Subtraction(int operand1, int operand2)
{
return (operand1 - operand2);
}
static int Division(int operand1, int operand2)
{
return (operand1 / operand2);
}


}
}
class Program
{

static void Main(string[] args)
{
Console.WriteLine("Enter the problem.\nInclude spaces in between for correct functioning.");
string Problem = Console.ReadLine();

string[] component = Problem.Split(' ');
int operand1 = int.Parse(component[0]);
string operation = (component[1]);
int operand2 = int.Parse(component[2]);
int result = 0;

if (operation == "+")
{
result = Addition(operand1, operand2);
}

else if (operation == "*")
{
result = Product(operand1, operand2);
}
else if (operation == "-")
{
result = Subtraction(operand1, operand2);
}
else if (operation == "/")
{
result = Division(operand1, operand2);
}

Console.WriteLine("Your Result is" + result);
}

static int Addition(int operand1, int operand2)
{
return (operand1 + operand2);
}
static int Product(int operand1, int operand2)
{
return (operand1 * operand2);
}
static int Subtraction(int operand1, int operand2)
{
return (operand1 - operand2);
}
static int Division(int operand1, int operand2)
{
return (operand1 / operand2);
}


}
}
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
yeah I fixed it now
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
I'll have to use the %
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
yeah I wasn't sure what to name them so I just put some jibberish
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
Okay, I got it
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
Hold on I'll be back in 10 mins
260 replies
CC#
Created by Rikk on 5/11/2023 in #help
✅ Need help regarding variables and class.
it works perfectly too
260 replies