ft_print_numbers.c 342 B

123456789101112131415161718192021222324252627282930
  1. / Create a function that displays all digits, on a single line, by ascending order.
  2. # include <unistd.h>
  3. void ft_putchar(char c)
  4. {
  5. write(1, &c, 1);
  6. }
  7. void ft_print_numbers(void)
  8. {
  9. char i;
  10. char n;
  11. i = 48;
  12. n = 10;
  13. while (i <= 57)
  14. {
  15. ft_putchar(i);
  16. i++;
  17. }
  18. ft_putchar(n);
  19. }
  20. int main(void)
  21. {
  22. ft_print_numbers();
  23. return 0;
  24. }