CircleR=6; /* radius */ s=deg30; /* central angle */ print "Circle circle area=",pi*R^2," circumference=",2*pi*R," sector area=",torad(s)*R^2/2," arc length=",torad(s)*R," chord length=",2*R*sin(s/2)," segment area=",(torad(s)-sin(s))*R^2/2," segment height=",R*(1-cos(s/2)) |
Kitec=4.4721; d=2.8284; /* sides */ f=4; g=6; /* diagonals */ print "Kite area=",(f*g)/2," perimeter=",2*(c+d) |
ParallelogramL=4.5; /* lateral side */ W=6; /* base side */ h=4; /* height */ print "Parallelogram area=",W*h," perimeter=",2*(L+W)," diagonal p=",sqrt(W^2+L^2+2*W*sqrt(L^2-h^2))," diagonal q=",sqrt(W^2+L^2-2*W*sqrt(L^2-h^2))," alpha=",asin(h/L)," beta=",deg180-Ans |
RectangleL=6; W=5; print "Rectangle area=",L*W," perimeter=",2*(L+W)," diagonal=",hypot(L,W) |
Regular Polygonn=5; /* number of vertices */ s=6; /* side length */ print "Regular polygon area=",s^2*n/4*cot(deg180/n)," perimeter=",s*n," angle=",(1-2/n)*deg180," circumradius=",s/2/sin(deg180/n)," apothem=",s/2*cot(deg180/n) |
Rhombuss=5; h=4.5; print "Rhombus area=",s*h," perimeter=",4*s," diagonal p=",sqrt(2*s*(s+sqrt(s^2-h^2)))," diagonal q=",sqrt(2*s*(s-sqrt(s^2-h^2)))," alpha=",asin(h/s)," beta=",deg180-Ans |
Squares=6; print "Square area=",s^2," perimeter=",4*s," diagonal=",s*sqrt2 |
Trapezoida=6; b=3; /* parallel bases */ c=3; d=3.5; /* lateral sides */ print "Trapezoid height=",h=sqrt((-a+b+c+d)*(a-b+c+d)*(a-b+c-d)*(a-b-c+d))/2/abs(b-a)," area=",(a+b)/2*h," perimeter=",a+b+c+d," alpha=",asin(h/c)," beta=",asin(h/d) |
Trianglea=3; b=4; c=5; p=(a+b+c)/2; S=sqrt(p*(p-a)*(p-b)*(p-c)); if(real ans,gotor3,0); print"Triangle inequality is false !";return; print"Triangle alpha=",acos((b^2+c^2-a^2)/(2*b*c))," beta=",acos((a^2+c^2-b^2)/(2*a*c))," gamma=",acos((b^2+a^2-c^2)/(2*b*a))," Perimeter=",a+b+c," Area=",S," Incircle=",S/p," Circumscribed circle=",a*b*c/4/S," Altitude a=",2*S/a," Altitude b=",2*S/b," Altitude c=",2*S/c," Median a=",sqrt(2*(b^2+c^2)-a^2)/2," Median b=",sqrt(2*(a^2+c^2)-b^2)/2," Median c=",sqrt(2*(b^2+a^2)-c^2)/2 |