FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 29   



Following program shows you how to calculate triangle circumference.
This program gets triangle sides from user and calculates circumference and prints it using following formula
Circumference = side1 + side2 + side3

using System;

class MainClass {
  public static void Main (string[] args) {
    Console.WriteLine("Enter the side1 of triangle:");
    double triangleSide1 = Convert.ToDouble(Console.ReadLine());
    Console.WriteLine("Enter the side2 of triangle:");
    double triangleSide2 = Convert.ToDouble(Console.ReadLine());
    Console.WriteLine("Enter the side3 of triangle:");
    double triangleSide3 = Convert.ToDouble(Console.ReadLine());
    double circumferenceOfTriangle = triangleSide1 + triangleSide2 + triangleSide3;
    Console.WriteLine("Circumference of triangle is: " + circumferenceOfTriangle);

  }
}

Output:

Enter the side1 of triangle:
 12
Enter the side2 of triangle:
 15
Enter the side3 of triangle:
 18
Circumference of triangle is: 45



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News