Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <stdio.h>
- using namespace std;
- main()
- {
- double a,s,d,h,v,b;
- cin >> a >> d;
- s = a*a + 4*sqrt(d*d-a/2*a/2)/2*a;
- b = a*sqrt(2)/2;
- h = sqrt(d*d-b*b);
- v = a*a*h/3;
- printf("%.3f %.3f\n", s,v);
- return 0;
- }
Add Comment
Please, Sign In to add comment