hallo Leute
ist es möglich die aktuelle woche als zahl ausgeben zu lassen???
also woche 1 bis 52???
hallo Leute
ist es möglich die aktuelle woche als zahl ausgeben zu lassen???
also woche 1 bis 52???
Ne fertige Funktion gibts dafür glaub nicht...
Musst du dir iwie mit
_NowDate()
[/autoit]basteln...
Nen Array mit den Monaten und den dazugehörigen Monatstagen und dann immer durch 7.
So iwie
Hab hier was gefunden was dich interessieren könnte:
[autoit]_WeekNumberISO()
[/autoit]Vllt so:
[autoit]$a = Round(@YDAY/7, 0)
MsgBox(0, "", $a)
_WeekNumberISO
[/autoit]ok danke funktioniert danke an alle nun noch eine andere frage ist es möglich zu überprüfen ob eine zahl gerade oder ungerade ist also zb 1=ungerade 2=gerade
Hallo alexanderschill,
Hilfe lesen bildet:
$n = 18
If mod($n, 2) = 0 Then
MsgBox(0,"", $n & " ist eine gerade Zahl.")
Else
MsgBox(0, "", $n & " ist eine ungerade Zahl.")
EndIf
$x = mod(4, 7) ;$x == 4 weil der Divisor > Dividend ist
$y = mod(1, 3/4) ;$y == 0.25 weil der Divisor ein Fließkommaformat aufweist
[/autoit]mfg autoBert
oh sry hab das gar nich gesehen thx leute
Da auch negative Zahlen gerade/ungerade sind, empfiehlt sich folgendes:
[autoit]Func _IsEven($i)
If $i < 0 Then $i = -1 * $i
If Mod($i, 2) Then Return False
Return True
EndFunc
BugFix ,
wie du mit diesem kleinen Skript:
[autoit]for $i = 1 to 99
$x =Random(-99,99,1)
if mod($x,2) = 0 Then
ConsoleWrite("Zahl: " & $x & " ist gerade" & @CRLF)
Else
ConsoleWrite("Zahl: " & $x & " ist ungerade" & @CRLF)
EndIf
Next
testen kannst kommt mod auch mit negativen Zahlen zurecht,
mfg autoBert
Hallo,
falls die Mod() Funktion nicht speziell optimiert sein sollte, geht es auch etwas sparsamer:
[autoit]For $I = 1 To 50
$X = Random(-99, 99, 1)
If BitAND($X, 1) Then
ConsoleWrite("Zahl: " & $X & " ist ungerade" & @CRLF)
Else
ConsoleWrite("Zahl: " & $X & " ist gerade" & @CRLF)
EndIf
Next
Oder:
[autoit][/autoit][autoit][/autoit][autoit]For $i = 1 To 50
$zahl = Random(-99, 99, 1)
If IsInt($zahl / 2) Then
ConsoleWrite($zahl & " ist gerade" & @CRLF)
Else
ConsoleWrite( $zahl & " ist ungerade" & @CRLF)
EndIf
next
geht wie mit geraden als auch ungeraden Zahlen
danke leute aber dieses problem wurde schon lange gelöst bitte keine weiteren beiträge mehr