In this program I am trying to create a simple calculator. However, I can't seem to find a way to overcome the aforementioned error when reaching the Math.Pow
line.
namespace BinaryCalc
{
class Binary
{
public static void Main()
{
int addition,subtraction;
float division, multiplication, power, sqrt;
int x;
int y;
x = 10;
y = 7;
//Console.WriteLine("Please enter a number for x");
//string line = Console.ReadLine();
//int x = int.Parse(line);
//Console.WriteLine("Please enter a number for y");
//string line2 = Console.ReadLine();
//int y = int.Parse(line2);
addition = (int)x + (int)y;
subtraction = (int)x - (int)y;
division = (float)x / (float)y;
multiplication = (float)x * (float)y;
power = Math.Pow(x,2);
sqrt = Math.Sqrt(x);
Console.WriteLine(" Addition results in {0}", addition);
Console.WriteLine(" Subtraction results in {0}", subtraction);
Console.WriteLine(" Division results in {0}", division);
Console.WriteLine(" Multiplication results in {0}", multiplication);
Console.WriteLine(" {0} squared results in {0}",x, power);
Console.WriteLine(" Square root of {0} is: {0}", x, sqrt);
}
}
}