Q:

Formatting a barcode with hyphens in between - Assignment question

The assignment at my first year uni computing course says my program should read a barcode number, and then display the same 13 digit barcode number separated by hyphens. For example, 9300675016902 should look like 930-067501-690-1. 
The restrictions say I can't use the following:
No arrays
No strings
No functions.
Any directions on this?
So far I have:
part1 = barcode/10000000000;

which gives me the first three digits, and this:
part4 = barcode%10;

which gives me the last digit.
Thanks in advance!

A:

Try:
    long p1 = n/10000000000;
    long p2 = n%100000000000/10000;
    long p3 = n%10000/10;
    long p4 = n%10;
    printf("%03ld-%06ld-%03ld-%01ld\n",p1,p2,p3,p4);

