- or download this
% cat sprin
#! /usr/bin/perl -w
...
printf "$num0 => %0.0f $num1 => %0.1f $num2 => %0.2f\n",
$num0, $num1, $num2;
}
- or download this
% perl sprin
1.0 => 1 1.00 => 1.0 1.000 => 1.00
...
1.7 => 2 1.07 => 1.1 1.007 => 1.01
1.8 => 2 1.08 => 1.1 1.008 => 1.01
1.9 => 2 1.09 => 1.1 1.009 => 1.01
- or download this
include <stdlib.h>
#include <stdio.h>
...
printf( buf, *argv, f );
return 0;
}
- or download this
% ./s %0.0f 0.4
0.4 => 0
...
1.5 => 2
% ./s %0.0f 1.6
1.6 => 2