[Solved] Printf spaces if number < 10 using only printf [duplicate]
printf(“%2d”, yournumber) will print number with 2 characters. If number is less than 2 chars long, spaces will be included before number. In case number is bigger than 2 digits, modifier has no effect and entire number will be printed. printf(“%2d”, 1); // ” 1″ printf(“%2d”, 10); // “10” printf(“%2d”, 100); // “100” 4 solved … Read more