Largest five adjacent number: Difference between revisions

Added AutoHotkey
(Added AutoHotkey)
Line 81:
(example)
<pre>99994</pre>
 
=={{header|AutoHotkey}}==
<lang AutoHotkey>maxNum := 0, str := ""
loop, 1000
{
Random, rnd, 0, 9
str .= rnd
output .= rnd . (Mod(A_Index, 148) ? "" : "`n")
if A_Index < 5
continue
num := SubStr(str, A_Index-4, 5)
maxNum := maxNum > num ? maxNum : num
minNum := A_Index = 5 ? num : minNum < num ? minNum : num
}
MsgBox % result := output "`n`nLargest five adjacent digits = " maxNum
. "`n`nSmallest five adjacent digits = " minNum</lang>
{{out}}
<pre>3893212622395522104846091986776081862634026945871752892124324578621089065097043281907406149009719673003318226562809101957181871693776164191416491334
2509291361707848297387923254298547833186351133036771338719578505791529263806019240009497155124458943732581184022226943392528107498748575424217651885
3083736872582691290721469942482918430078673685947447234032602113276631102983248999047362916320523840282929255314468323644427797630259187509914424396
1523615571637081320270791095221484894567420630155741441396012393172769867922862248399483054652921274863786220527596050784952102267710198517665662903
6335615800351254988779849447078262460051794249274045128158246939351902901862546960248213286880570086476859341012102414828750098051948784732121573660
9618754338433412518619240496583375235634416473003920360759949694724646721954909867058588446320222792637823988375313876167705092153587245148819122980
2777308429997046827297505483667631338885207838402941712216614732232703459440770039141898763110002290662921501156
 
Largest five adjacent digits = 99970
 
Smallest five adjacent digits = 00022</pre>
 
=={{header|AWK}}==
<lang AWK>
299

edits