enter image description here

program lr3; var x,y : real; begin readln(x); if (sqr(sin(x))>=1/2) then y:=-2*sqr(sin(x)); if (1/4 < sqr(sin(x))) then if(sqr(sin(x)) < 1/2) then y:=0.0000016; if(sqr(sin(x))<=1/4) then y:=sqr(tan(x)); writeln(y); end. 
  • It makes no sense to re-calculate the already computed ... - Harry

1 answer 1

 program lr3; var x, y: double; var sinX2: double; begin readln(x); sinX2 := sqr(sin(x)); if sinX2 >= 0.5 then begin y := -2 * sinX2; end else if sinX2 > 0.25 then begin y := -1.6E-6; end else begin y := sqr(tan(x)); end; writeln(y); end. 
  • one
    Only y := -1.6E-6; , in the original, too, an error. - Alekcvp
  • @Alekcvp thanks, corrected - Igor