28 lines
462 B
Plaintext
28 lines
462 B
Plaintext
include "NSLog.incl"
|
|
|
|
void local fn BuildHamonics
|
|
double h = 0.0
|
|
long i, n
|
|
|
|
NSLog( @"The first twenty harmonic numbers are:\n" )
|
|
for i = 1 to 20
|
|
h = h + 1.0 / i
|
|
NSLog( @"%3d. %.8f", i, h )
|
|
next
|
|
|
|
NSLog( @"\n" )
|
|
|
|
h = 1 : n = 2
|
|
for i = 2 to 10
|
|
while h < i
|
|
h = h + 1.0 / n
|
|
n = n + 1
|
|
wend
|
|
NSLog( @"The first harmonic number > %2d is %11.8f at position %d.", i, h, n -1 )
|
|
next
|
|
end fn
|
|
|
|
fn BuildHamonics
|
|
|
|
HandleEvents
|