Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 19th, 2010 | Syntax: None | Size: 0.27 KB | Hits: 68 | Expires: Never
Copy text to clipboard
  1. //Heron
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. double a, x, xalt;
  8. cout<<endl;
  9. cout << "Geben Sie a ein ";
  10. cin >> a;
  11.  
  12. x=1;
  13.  
  14. while (xalt-x < 0.01)
  15. {
  16. xalt=x;
  17. x=(x+a/x)/2;
  18. }
  19. cout <<endl;
  20. cout << "Die Wurzel aus "<< a <<" ist " << x <<endl;
  21. }