Console.WriteLine("Enter the first side of the triangle: "); side1 = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Enter the second side of the triangle: "); side2 = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Enter the angle between the sides (in degrees): "); angle = Convert.ToDouble(Console.ReadLine()); // Convert angle from degrees to radians double angleInRadians = angle * Math.PI / 180; // Calculate the heights using trigonometry height1 = Math.Sin(angleInRadians) * side2; height2 = Math.Sin(angleInRadians) * side1; Console.WriteLine("The height from the first side is: " + height1); Console.WriteLine("The height from the second side is: " + height2); }
using System;
class Triangle
Console.WriteLine("Enter the first side of the triangle: ");{
static void Main()
{
double side1, side2, angle, height1, height2;
side1 = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter the second side of the triangle: ");
side2 = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter the angle between the sides (in degrees): ");
angle = Convert.ToDouble(Console.ReadLine());
// Convert angle from degrees to radians
double angleInRadians = angle * Math.PI / 180;
// Calculate the heights using trigonometry
height1 = Math.Sin(angleInRadians) * side2;
height2 = Math.Sin(angleInRadians) * side1;
Console.WriteLine("The height from the first side is: " + height1);
Console.WriteLine("The height from the second side is: " + height2);
}
}