I have written a program in C# that runs the Pythagorean Theorem. I would love some help on allowing the program to accept decimal points from the user input. This is what I have.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Project_2
{
class Program
{
static void Main(string[] args)
{
int sideA = 0;
int sideB = 0;
double sideC = 0;
Console.Write("Enter a integer for Side A ");
sideA = Convert.ToInt16(Console.ReadLine());
Console.Write("Enter a integer for Side B ");
sideB = Convert.ToInt16(Console.ReadLine());
sideC = Math.Pow((sideA * sideA + sideB * sideB), .5);
Console.Write("Side C has this length...");
Console.WriteLine(sideC);
Console.ReadLine();
}
}
}
I have been trying to research this by using the Math.Abs and so on only to receive build errors. Help in the write path would be greatly appreciated.