fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #define NAME "GIGATHINK, INC."
  4. #define ADDRESS "101 Megabuck Plaza"
  5. #define PLACE "Megapolis, CA 94904"
  6. #define WIDTH 40
  7. #define SPACE ' '
  8.  
  9. void show_n_char(char ch, int num);
  10.  
  11. int main(void) {
  12. int spaces;
  13.  
  14. show_n_char ('*', WIDTH);
  15. putchar('\n');
  16. show_n_char(SPACE, 12);
  17. printf("&s\n", NAME);
  18. spaces = (WIDTH - strlen(ADDRESS)) / 2;
  19. printf("%s\n", PLACE);
  20. show_n_char('*', WIDTH);
  21. putchar('\n');
  22.  
  23. return 0;
  24. }
  25.  
  26. void show_n_char(char ch, int num)
  27. {
  28. int count;
  29.  
  30. for (count = 1; count <= num; count++)
  31. putchar(ch);
  32. }
  33.  
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
****************************************
            &s
Megapolis, CA 94904
****************************************