12-01-2022, 11:16 PM
Hello Betty, for me it is important to clearly show what is happening. The usual exception is when I call a function as an argument to a function, there would be Call be kind of out of place.
Code: (Select All)
Option _Explicit
Declare Function Nte_Wurzel(n As Double, x As Double) As Double
Declare Function Nte_Potenz(n As Double, x As Double) As Double
Dim As Double n, x
Print
Input "Wurzelexponent: ", n
Input "Radikand : ", x
Print
Print Using "Die ###.## Wurzel aus ###.## ist: ##.##########"; n, x, Nte_Wurzel(n, x)
Print: Print
Print "Ueberpruefung: Wurzelwert mit demselben Exponenten potenzieren"
Print
Print Using "Wurzelwert ##.########## potenziert mit Exponent ###.## ergibt: ####.######"; Nte_Wurzel(n, x), n, Nte_Potenz(Nte_Wurzel(n, x), n)
End
Function Nte_Wurzel (n As Double, x As Double)
Dim wurzelx As Double
wurzelx = x ^ (1 / n)
Nte_Wurzel = wurzelx
End Function
Function Nte_Potenz (wurzelx As Double, exponent As Double)
Dim potenz As Double
potenz = wurzelx ^ exponent
Nte_Potenz = potenz
End Function