C examples for Language Basics:printf
Integer Output with printf
#include <stdio.h> int main(void) { int i = 15, j = 345, k = 4567; long long li = 56789LL, lj = 12345678912LL, lk = 12345667LL; printf("i = %d j = %d k = %d i = %6.3d j = %6.3d k = %6.3d\n", i ,j, k, i, j, k); printf("i = %-d j = %+d k = %-d i = %-6.3d j = %-6.3d k = %-6.3d\n",i ,j, k, i, j, k); printf("li = %d lj = %d lk = %d\n", li, lj, lk); printf("li = %lld lj = %lld lk = %lld\n", li, lj, lk); return 0;/*from w w w. j av a2 s. co m*/ }