File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3095,18 +3095,18 @@ <h3 itemprop="eduQuestionType" style="margin:7px">Area of a Circle Segment</h3>
30953095 autoFilledField = "segment-height" ;
30963096 }
30973097
3098- // Validity checks
3099- if ( h > r || l < 2 * h || r < h ) {
3100- document . getElementById ( 'segment-area' ) . innerText =
3101- 'Invalid: must satisfy h ≤ r, l ≥ 2h, r ≥ h.' ;
3102- // ❌ no return here — keep listening for further input
3103- } else {
31043098 // Compute angle and area
31053099 let angle = Acos ( ( r - h ) / r ) ;
31063100 let area = angle * r ** 2 - ( r - h ) * ( l / 2 ) ;
31073101
31083102 // Output with semicircle reminders
3109- if ( h === r || h === l / 2 || l === 2 * r ) {
3103+ // Validity checks
3104+ if ( h > r || l < 2 * h || r < h ) {
3105+ document . getElementById ( 'segment-area' ) . innerText =
3106+ 'Invalid: must satisfy h ≤ r, l ≥ 2h, r ≥ h.' ;
3107+ // no return here — keep listening for further input
3108+ } else {
3109+ if ( h === r || h === l / 2 || l === 2 * r ) {
31103110 document . getElementById ( 'segment-area' ) . innerText =
31113111 `Semicircle area: ${ area . toFixed ( 5 ) } square units` ;
31123112 } else {
You can’t perform that action at this time.
0 commit comments