#include <stdio.h>
int main()
{
printf("%6.6d\n",3);
printf("%6.3d\n",3);
printf("%-6.3d\n",3);
printf("%+6.3d\n",3);
printf("%-+6.3d\n",3);
return(0);
}
The above C code gives the follwing results:
While the package "sprintf`" gives the follwing results which are different from those of C.
In[2]:= sprintf["%6.6d",3]
Out[2]= 3
In[3]:= sprintf["%6.3d",3]
Out[3]= 3
In[4]:= sprintf["%-6.3d",3]
Out[4]= 3
In[5]:= sprintf["%+6.3d",3]
Out[5]= +3
In[6]:= sprintf["%-+6.3d",3]
Out[6]= +3
The above C code gives the follwing results:
While the package
"sprintf`"gives the follwing results which are different from those of C.