Home > Article > Backend Development > Write a program to calculate the perimeter of a decagon in C language
Given the side lengths, the task is to calculate the perimeter of the decagon. A decagon is a polygon with 10 sides, so it is also called a decagon. It has 10 vertices and edges. A regular decagon has equal sides and each interior angle is 144 degrees.
The following is the graphic of a decagon
There is a formula for calculating the volume and surface area of a truncated cone
Perimeter = 10 * Side
Input-: side=10 Output-: perimeter of Decagon is : 100 Input -: side = 20 Output -: perimeter of Decagon is : 200
Start Step 1 -> declare function for finding the perimeter void perimeter(int n) declare variable as int perimeter set perimeter=10*n print perimeter step 2 -> In main() declare int n=10 perimeter(n) Stop
#include <stdio.h> // Function for finding the perimeter void perimeter(int n){ int perimeter; perimeter = 10 * n; printf("perimeter of Decagon is : %d", perimeter); } int main(){ int n=10; perimeter(n); return 0; }
perimeter of Decagon is : 100
The above is the detailed content of Write a program to calculate the perimeter of a decagon in C language. For more information, please follow other related articles on the PHP Chinese website!