Formatted numeric output: Difference between revisions
Content added Content deleted
(→{{header|Chipmunk BASIC}}: Added.) |
(→{{header|Nascom BASIC}}: Added.) |
||
Line 440: | Line 440: | ||
Raw number = 0.1007265e-2 Using custom function = 0000000000.00101 |
Raw number = 0.1007265e-2 Using custom function = 0000000000.00101 |
||
</pre> |
</pre> |
||
==={{header|Nascom BASIC}}=== |
|||
{{trans|ZX Spectrum Basic}} |
|||
{{works with|Nascom ROM BASIC|4.7}} |
|||
<syntaxhighlight lang="basic"> |
|||
10 REM Formatted numeric output |
|||
20 CLS |
|||
30 LET N=7.125 |
|||
40 LET W=9 |
|||
50 GOSUB 1000 |
|||
60 SCREEN 10,9:PRINT N$ |
|||
70 END |
|||
1000 REM Formatted fixed-length |
|||
1010 N$=STR$(N):N$=RIGHT$(N$,LEN(N$)-1) |
|||
1020 FOR I=1 TO W-LEN(N$) |
|||
1030 N$="0"+N$ |
|||
1040 NEXT I |
|||
1050 RETURN |
|||
</syntaxhighlight> |
|||
==={{header|PureBasic}}=== |
==={{header|PureBasic}}=== |