-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathx hoch n.ps1
More file actions
52 lines (39 loc) · 887 Bytes
/
Copy pathx hoch n.ps1
File metadata and controls
52 lines (39 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#script zur berechnung von x^n
#x aus den reellen Zahlen
#n in natürlichen Zahlen
cls
[int]$x = read-host "Bitte X angeben"
[int]$n = read-host "Bitte n angeben"
$summe = $x
[int]$i = 1
#für den [math]-operator
$a = $x
$b = $n
#für die 2te Rechnung 1/x mal 1/x ...
[int]$zähler = 1
$basis2 = $x
$hoch2 = $n
#$hochzahl = 0
$summe2 = 1
if($n -eq 0){
"Das Ergebnis ist 1"
break
}
while ($i -lt $n){
$hochzahl = $summe * $x
$summe = $hochzahl
$i ++
}
"Das Ergebnis aus $x hoch $n ist $hochzahl"
#geschummelt
$g = [math]::pow($a,$b)
"Geschummelt: $g"
while ($zähler -le $hoch2){
$hochzahl = 1 / ($basis2)
#$hochzahl
$summe2 = $summe2 * $hochzahl
#$summe2
$zähler ++
}
$neuezahl = (1 / ($summe2))
"Mit der anderen Rechnung ergibt Die Rechnung $x hoch $n = $neuezahl"