Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- void cilindr(double s, double v, double *pr, double *ph);
- int main(void)
- {
- double r,h, r1=0,h1=0, s, v, k;
- scanf("%lf",&r);
- scanf("%lf",&h);
- cilindr(r,h, &s, &v);
- /* printf("ploshad=%lf, obem=%lf",s,v ); */
- k=1000000.;
- for (r=1.;r<=50.;++r);
- s=2*M_PI*r*(r+h);
- if (fabs((r/(2*(r+h))-1)<fabs(k-1))
- { k=(r/(2*(r+h)));
- r1=r;
- h1=h;
- }
- }
- }
- printf("%.0lf\n", r1);
- printf("%.0lf", h1 );
- return 0;
- }
- void cilindr(double x, double y, double *ps , double *pv)
- {
- *ps=2*M_PI*x*(x+y);
- *pv=M_PI*y*pow(x,2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement