Advertisement
Guest User

Untitled

a guest
Feb 28th, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <cmath>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. double a,b,c;
  9. scanf("%lf%lf%lf",&a,&b,&c);
  10. double ans = a/b;
  11. for(int i=0;i<c;i++)
  12. {
  13. ans*=10;
  14. }
  15.  
  16. int transform = ans+0.5;
  17. ans = double(transform)/10;
  18. for(int i=1;i<c;i++)
  19. {
  20. ans/=10;
  21. }
  22. printf("%lf\n",ans);
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement