Find the Diameter or Longest chord of a Circle | C ++ program to find the longest chord or diameter of the circle whose radius is given ; Function to find the longest chord ; Driver code ; Get the radius ; Find the diameter
#include <bits/stdc++.h> NEW_LINE using namespace std ; void diameter ( double r ) { cout << " The ▁ length ▁ of ▁ the ▁ longest ▁ chord " << " ▁ or ▁ diameter ▁ of ▁ the ▁ circle ▁ is ▁ " << 2 * r << endl ; } int main ( ) { double r = 4 ; diameter ( r ) ; return 0 ; }