Formatted numeric output: Difference between revisions
→{{header|BASIC}}: Added ANSI BASIC.
(→{{header|BASIC}}: Added ANSI BASIC.) |
|||
(One intermediate revision by one other user not shown) | |||
Line 422:
=={{header|BASIC}}==
==={{header|ANSI BASIC}}===
{{works with|Decimal BASIC}}
<syntaxhighlight lang="basic">
100 REM Formatted numeric output
110 LET N = 7.125
120 PRINT USING ("%%%%.###"): N
130 PRINT USING ("****.###"): N
140 PRINT USING ("####.###"): N
150 PRINT USING ("+%%%.###"): N
160 PRINT USING ("+%%%.###"): -N
170 PRINT USING (".###^^^^^"): N
180 PRINT USING ("#.###^^^^^"): N
190 PRINT USING ("##.###^^^^^"): N
200 PRINT USING ("+.###^^^^^"): -N
210 END
</syntaxhighlight>
{{out}}
<pre>
0007.125
***7.125
7.125
+007.125
-007.125
.713E+001
7.125E+000
71.250E-001
-.713E+001
</pre>
==={{header|BaCon}}===
BaCon can use C style <tt>printf</tt> format specifiers.
Line 2,546 ⟶ 2,575:
=={{header|Wren}}==
{{libheader|Wren-fmt}}
<syntaxhighlight lang="
var n = 7.125
|