All pastes #446868 Raw Edit

Heron

public cpp v1 · immutable
·published 2007-04-18 18:36 UTC
rendered paste body
#include <iostream>using namespace std;float heron(double d,int s) {	double x = 1.5;	for(int i = 1;i <= s;i++) {		x = 0.5*(x + (d/x));	}	return x;}int main() {	double c;	int steps;	cout << "Bitte geben Sie eine natürliche Zahl ein:" << '\n';	cin >> c;	cout << "Bitte geben sie die Anzahl der Iterationen ein:" << '\n';	cin >> steps;	cout << heron(c,steps);	return 0;}