Skip to content

Instantly share code, notes, and snippets.

@BluePyTheDeer251
Last active November 21, 2024 17:18
Show Gist options
  • Save BluePyTheDeer251/b3ba6314f5e6b6606660dc852849e419 to your computer and use it in GitHub Desktop.
Save BluePyTheDeer251/b3ba6314f5e6b6606660dc852849e419 to your computer and use it in GitHub Desktop.
A C# program that will calculate the area of a triangle. (written with top-level functions)
Console.WriteLine("Please input the number of the base of the triangle. ");
int triangleBase = Convert.toInt32(Console.ReadLine());
Console.WriteLine("Please input the number of the height of the triangle. ");
int triangleHeight = Convert.toInt32(Console.ReadLine());
Console.WriteLine("Joining...");
int result = triangleBase * triangleHeight / 2;
Console.WriteLine($"Done! Your result: {result}");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment