Printing a space before the signed integer values in C programming using printf() C function

 

 

Compiler: Visual C++ Express Edition 2005

Compiled on Platform: Windows XP Pro SP2

Header file: Standard

Additional library: none/default

Additional project setting: Set project to be compiled as C

Project -> your_project_name Properties -> Configuration Properties -> C/C++ -> Advanced -> Compiled As: Compiled as C Code (/TC)

Other info: none

To do: Printing a space before the signed integer values in C programming

To show: How to put a space before signed integer values for printf() C function

 

 

// Printing a space before signed values not preceded by + or -

#include <stdio.h>

 

int main(void)

{

printf("Printing a space before signed values\n");

printf(" not preceded by + or -n\n");

printf("--------------------------------------\n\n");

printf("% d\n% d\n", 877, -877);

 

return 0;

}

 

Output example:

 

Printing a space before signed values

not preceded by + or -n

--------------------------------------

877

-877

Press any key to continue . . .

 

 

C and C++ Programming Resources | C & C++ Code Example Index