| |
|
|
p.specht
| The most joint Teiler (GGT) becomes today often to the "modernen Euklidischen Algorithmus" certainly. disadvantage: The thereby using MOD-commands is in gängigen Programmiersprachen unnötigerweise on Integerzahlen dull, sodaß the Standardalgorithmus only Ganzzahhlen processing. and there the Smallest joint Vielfache (KGV) as a*b/GGT(a,b) accounts becomes, alights one then ditto always with Ganzzahlen. an further Einschränkung lying in the usual constraint on two Parameter. what but, if the GGT or KGV of More as two Values determined go should? then helps the following Progrämmchen, that though not against To large and To small values ensured is. in the Normalfall works But.
Windowtitle "GGT and KGV of four Float-Zahlen"
(DF) demonstration-Freeware, without each Gewähr, 2013-04 by P. woodpecker
Windowstyle 1048:Randomize:Font 2
Declare a!,b!,c!,d!
While 1
cls rnd(8^8)
print " first number: ";:input a!
print " second number: ";:input b!
print " Dritte number: ";:input c!
print " fourth number: ";:input d!
print "-----------------------------"
print "Ergebnis GGT = ";stature$("%g",ggt(a!,ggt(b!,ggt(c!,d!))))
print " KGV = ";stature$("%g",kgv(a!,kgv(b!,kgv(c!,d!))))
waitinput
endwhile
proc ggt :parameters a!,b!
declare h!:whilenot nearly(b!,0,11)
h!=a!-b!*int(a!/b!):a!=b!:b!=h!
endwhile :return a!
endproc
proc kgv :parameters a!,b!
return a!*b!/ggt(a!,b!)
endproc
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/09/21 ▲ |
|
|
|