. .
: for, while, do... while.
. , , , .
for , while do... while , : while , do... while .
for while ( ) , , , . do... while do while, , .
. for : ( ), , ( ). for .
, ( ) ( ).
:
do {< >} while (<>);
, , do () while (). while . , , , . , , , repeat... until , .
, 1 .
. , , tg x 2x = 0. , x=0 . .
l r , . [l, r] , . , , .
|
|
//pol_del.c
#include<stdio.h>
#include <math.h>
double fun(double t){return tan(t)2*t;}
main(){
double l,r,x,eps;
printf(%s, , \n);
scanf(%lf%lf%lf,&l,&r,&eps);
do {
x=(l+r)/2;
if (fun(x) < 0) l = x;
else r = x;
} while (r l > eps);
x = (l + r)/2;
printf( %12.8lf\n, x);
return 0;
}
fun(t)=tg t 2t, . main l, r eps. , , l = 0.001; r = 1.5; eps = 0.000000001. [l, r] . fun(x) , (l = x), , (r = x).
, (). : 1.16556119.
fun, .