Add example inputs

This commit is contained in:
Alex Hirsch
2019-01-06 12:11:47 +01:00
parent 0045501c5e
commit bd7fae8198
36 changed files with 624 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
float kth(float k)
{
return 1.0 / (2.0 * k + 1.0);
}
int main()
{
print("Please enter a number: ");
float sign;
float n;
float i;
float pi;
i = 1.0;
n = read_float();
print_nl();
sign = 1.0;
pi = 1.0;
while (i < n)
{
sign = sign * (-1.0);
pi = pi + sign * kth(i);
i = i + 1.0;
}
pi = pi*4.0;
print("Pi is approximately ");
print_float(pi);
print_nl();
return 0;
}

View File

@@ -0,0 +1 @@
32

View File

@@ -0,0 +1,2 @@
Please enter a number:
Pi is approximately 3.11