fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. printf("1.%-9s %s","My","Hello"); //left align
  5. printf("\n");
  6. printf("2.%9s %s","My","Hello"); //rignt align
  7. // in both the above cases we used field width only for string "my" not to hello
  8.  
  9. return 0;
  10. }
  11.  
Success #stdin #stdout 0s 2292KB
stdin
Standard input is empty
stdout
1.My        Hello
2.       My Hello