Given side (a, b, c) of a triangle, we have to find the perimeter of a triangle.

**Perimeter :**

Perimeter of a triangle is the sum of the length of side of a triangle.

where a, b, c are length of side of a triangle.

Perimeter of a triangle can simply be evaluated using following formula :

Examples :

Input : a = 2.0, b = 3.0, c = 5.0 Output : 10.0 Input : a = 5.0, b = 6.0, c = 7.0 Output : 18.0

## C

`// A simple C program to find the perimeter ` `// of triangle ` `#include <stdio.h> ` ` ` `// Function to find perimeter ` `float` `findPerimeter(` `float` `a, ` `float` `b, ` `float` `c) ` `{ ` ` ` `// Formula for finding a perimeter of triangle ` ` ` `return` `(a + b + c); ` `} ` ` ` `// Driver Code ` `int` `main() ` `{ ` ` ` `float` `a = 2.0, b = 3.0, c = 5.0; ` ` ` `printf` `(` `"%f"` `, findPerimeter(a, b, c)); ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java program to find perimeter ` `// of triangle ` `class` `Test { ` ` ` `static` `float` `findPerimeter(` `float` `a, ` `float` `b, ` `float` `c) ` ` ` `{ ` ` ` `// Formula for Perimter of triangle ` ` ` `return` `(a + b + c); ` ` ` `} ` ` ` ` ` `// Driver method ` ` ` `public` `static` `void` `main(String[] args) ` ` ` `{ ` ` ` `float` `a = ` `2.0` `, b = ` `3.0` `, c = ` `5.0` `; ` ` ` `System.out.println(findPerimeter(a, b, c)); ` ` ` `} ` `} ` |

*chevron_right*

*filter_none*

## Python

`# Python Program to find a perimeter ` `# of triangle ` ` ` `# Function to find perimeter ` `def` `findPerimeter(a, b, c): ` ` ` ` ` `# Calculate the perimeter ` ` ` `return` `(a ` `+` `b ` `+` `c) ` ` ` `# Driver Code ` `a ` `=` `2.0` `b ` `=` `3.0` `c ` `=` `5.0` `print` `(findPerimeter(a, b, c)) ` |

*chevron_right*

*filter_none*

## C#

`// C# program to find perimeter ` `// of triangle ` `using` `System; ` ` ` `class` `Test { ` ` ` ` ` `static` `float` `findPerimeter(` `float` `a, ` ` ` `float` `b, ` `float` `c) ` ` ` `{ ` ` ` ` ` `// Formula for Perimter of triangle ` ` ` `return` `(a + b + c); ` ` ` `} ` ` ` ` ` `// Driver method ` ` ` `public` `static` `void` `Main() ` ` ` `{ ` ` ` `float` `a = 2.0f, b = 3.0f, c = 5.0f; ` ` ` ` ` `Console.WriteLine(findPerimeter(a, b, c)); ` ` ` `} ` `} ` ` ` `//This code is contributed by vt_m. ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// A simple PHP program ` `// to find the perimeter ` `// of triangle ` ` ` `// Function to find perimeter ` `function` `findPerimeter(` `$a` `, ` `$b` `, ` `$c` `) ` `{ ` ` ` ` ` `// Formula for finding a ` ` ` `// perimeter of triangle ` ` ` `return` `(` `$a` `+ ` `$b` `+ ` `$c` `); ` `} ` ` ` ` ` `// Driver Code ` ` ` `$a` `= 2.0; ` ` ` `$b` `= 3.0; ` ` ` `$c` `= 5.0; ` ` ` `echo` `findPerimeter(` `$a` `, ` `$b` `, ` `$c` `); ` ` ` `// This code is contributed by anuj_67. ` `?> ` |

*chevron_right*

*filter_none*

Output :

10.0

## Recommended Posts:

- Maximum Perimeter Triangle from array
- Program to calculate area and perimeter of equilateral triangle
- Program to calculate the Area and Perimeter of Incircle of an Equilateral Triangle
- Find the perimeter of a cylinder
- Program to find the Area and Perimeter of a Semicircle
- Program to find the Perimeter of a Regular Polygon
- Find maximum volume of a cuboid from the given perimeter and area
- Program to find Perimeter / Circumference of Square and Rectangle
- Find all angles of a given triangle
- Find all angles of a triangle in 3D
- Find the dimensions of Right angled triangle
- Find other two sides of a right angle triangle
- Program to find area of a triangle
- Program to find Circumcenter of a Triangle
- Program to find the Centroid of the triangle

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.