Skip to content

Latest commit

 

History

History

0x04-more_functions_nested_loops

0x04. C - More functions, more nested loops

Learning objectives for this project:

  • What are nested loops and how to use them
  • What is a function and how do you use functions
  • What is the difference between a declaration and definition of a function
  • What is a prototype?
  • Scope of variables
  • What are the gcc flags -Wall -Werror -pendatic -Wextra -std=gnu89
  • What are header files and how to use them with #include

Tasks 📃

  • 0-isupper
    • 0-isupper.c: C function that checks for uppercase characters. Returns 1 if the character is uppercase, 0 otherwise.
  • 1. isdigit

    • 1-isdigit.c: C function that checks for a digit (0 through 9). Returns 1 if the character is a digit, 0 otherwise.
  • 2. Collaboration is multiplication

    • 2-mul.c: C function that multiplies two integers. Returns the value of the multiplication.
  • 3. The numbers speak for themselves

    • 3-print_numbers.c: C function that prints the numbers 0 to 9, followed by a new line.
  • 4. I believe in numbers and signs

    • 4-print_most_numbers: C function that prints the numbers 0 to 9 except for 2 and 4, followed by a new line.
  • 5. Numbers constitute the only universal language

    • 5-more_numbers.c: C function that prints the numbers 0 to 14, followed by a new line, ten times.
  • 6. The shortest distance between two points is a straight line

    • 6-print_line.c: C function that draws a straight line in the terminal using the character _, followed by a new line.
      • If the function receives length input of zero or less, only a new line is printed.
  • 7. I feel like I am diagonally parked in a parallel universe

    • 7-print_diagonal.c: C function that draws a diagonal line in the terminal using the \ character, followed by a new line.
      • If the function receives length input of zero or less, only a new line is printed.
  • 8. You are so much sunshine in every square inch

    • 8-print_square.c: C function that prints a square using the # character, followed by a new line.
      • If the function receives size input of zero or less, only a new line is printed.
  • 9. Fizz-Buzz

    • 9-fizz_buzz.c: C program that prints the numbers from 1 to 100, but for multiples of three, Fizz is printed instead of the number, for multiples of five, Buzz, and for multiples of both three and five, FizzBuzz.
      • Each number or word is separated by a space.
  • 10. Triangles

    • 10-print_triangle.c: C function that prints a triangle using the # character, followed by a new line.
      • If the function receives size input of zero or less, only a new line is printed.
  • 11. The problem of distinguishing prime numbers from composite numbers and of resolving the latter into their prime factors is known to be one of the most important and useful in arithmetic

    • 100-prime_factor.c: C program that prints the largest prime factor of the number 612852475143, followed by a new line.
  • 12. Numbers have life; they're not just symbols on paper

    • 101-print_number.c: C function that prints an integer without using long, arrays, pointers, or hard-coded special values.