fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. printf("Strings:\n");
  5. const char* s = "Hello";
  6. printf("\t.%10s.\n\t.%-10s.\n\t.%*s.\n", s, s, 10, s);
  7. printf("Characters:\t%c %%\n", 65); //olha o duplo aqui, veja o resultado
  8. printf("Integers\n");
  9. printf("Decimal:\t%i %d %.6i %i %.0i %+i %i\n", 1, 2, 3, 0, 0, 4, -4);
  10. printf("Hexadecimal:\t%x %x %X %#x\n", 5, 10, 10, 6);
  11. printf("Octal:\t%o %#o %#o\n", 10, 10, 4);
  12. printf("Floating point\n");
  13. printf("Rounding:\t%f %.0f %.32f\n", 1.5, 1.5, 1.3);
  14. printf("Padding:\t%05.2f %.2f %5.2f\n", 1.5, 1.5, 1.5);
  15. printf("Scientific:\t%E %e\n", 1.5, 1.5);
  16. printf("Hexadecimal:\t%a %A\n", 1.5, 1.5);
  17. }
  18.  
  19. //https://pt.stackoverflow.com/q/483758/101
Success #stdin #stdout 0s 4316KB
stdin
Standard input is empty
stdout
Strings:
	.     Hello.
	.Hello     .
	.     Hello.
Characters:	A %
Integers
Decimal:	1 2 000003 0  +4 -4
Hexadecimal:	5 a A 0x6
Octal:	12 012 04
Floating point
Rounding:	1.500000 2 1.30000000000000004440892098500626
Padding:	01.50 1.50  1.50
Scientific:	1.500000E+00 1.500000e+00
Hexadecimal:	0x1.8p+0 0X1.8P+0