Diagonal of a Regular Pentagon | C ++ Program to find the diagonal of a regular pentagon ; Function to find the diagonal of a regular pentagon ; Side cannot be negative ; Length of the diagonal ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; float pentdiagonal ( float a ) { if ( a < 0 ) return -1 ; float d = 1.22 * a ; return d ; } int main ( ) { float a = 6 ; cout << pentdiagonal ( a ) << endl ; return 0 ; }