|
|
back to boardCE, help Why CE with this code? #include <stdio.h> int main() { float PI = 3.1415926535; float squareSize; scanf("%f", &squareSize); squareSize /= 2; int rope; scanf("%i", &rope); float diagonal; diagonal = sqrt((double) (2 * squareSize * squareSize)); double area; if (rope <= squareSize) printf("%1.3f", (rope * rope * PI)); else { if (rope >= diagonal) printf("%1.3f", (squareSize * squareSize)); else { area = 8 * (squareSize * sqrt((double) (rope * rope - squareSize * squareSize))/2 + rope*rope/2 * (PI/4 - acos( (double) (squareSize / rope)))); printf("%1.3f", area); } } return 0; } |
|
|