Largest sphere that can be inscribed inside a cube | C ++ Program to find the biggest sphere inscribed within a cube ; Function to find the radius of the sphere ; side cannot be negative ; radius of the sphere ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; float sphere ( float a ) { if ( a < 0 ) return -1 ; float r = a / 2 ; return r ; } int main ( ) { float a = 5 ; cout << sphere ( a ) << endl ; return 0 ; }