Solution to complex problems using functions and nested loops.
Write a function that checks for if a character is uppercase.
- Prototype:
int _isupper(int c); - Returns
1ifcis uppercase - Returns
0otherwise
Write a function that checks for if a character is a digit.
- Prototype:
int _isdigit(int c); - Returns
1ifcis a digit - Returns
0otherwise
Write a function that multiplies two integers.
- Prototype:
int mul(int a, int b)
Write a function that prints the numbers, from 0 to 9, followed by a new line.
- Prototype:
void print_numbers(void); - You can only use
_putchartwice in your code
Write a function that prints the numbers, from 0 to 9, followed by a new line.
- Prototype:
void print_most_numbers(void); - Do not print 2 and 4
- You cn only use
_putchartwice in your code
Write a function that prints 10 times the numbers, from 0 to 14, followed by a new line.
- Prototype:
void more_numbers(void); - You can only use
_putcharthree times in your code.
Write a function that draws a straight line in the terminal.
- Prototype:
void print_line(int n); - You can only use the
_putcharfunction to print - Where
nis the number of times the character_should be printed - The line shold end with a
\n - if
nis 0 or less, the function should only print\n
Write a function that draws a diagonal line in the terminal.
- Prototype:
void print_diagonal(int n); - You can only use the
_putcharfunction to print - Where
nis the number of times the character\should be printed - The line shold end with a
\n - if
nis 0 or less, the function should only print\n
Write a function that prints a square followed by a new line.
- Prototype:
void print_square(int size); - You can only use
_putcharfunction to print. - Where
sizeis the size of the square - If
sizeis 0 or less, the function should print only a newline - Use the character
#to print the square
Write a program that prints out the numbers from 1 to 100, followed by a new line. But for multiples of 3 print Fizz instead of the number and for multiples of 5 print Buzz. For numbers which are multiples of both, print FizzBuzz.
- Each number or word should be separated by a space
- You are allowed to use the standard library
Write a function that prints a triangle, followed by a new line
- Prototype:
void print_triangle(int size); - You can only use
_putcharfunction to print - Where
sizeis the size of the triangle - if size is 0 or less, the function should print only a new line
- Use the character
#to print the triangle
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 arithmetic
Write a program that finds and prints the largest prime factor of the number 612852475143, followed by a new line.
- You are allowed to use the standard library
- Your program would be compiled with this command `gcc -Wall -Werror -Wextra -pedantic -std=gnu89 100-prime_factor.c -o 100-prime_factor -lm
Write a function that prints an integer
- Prototype:
void print_number(int n); - You can only use
_putcharfunction to print - You're not allowed to use long
- You're not allowed to use arrays or pointers
- You're not allowed to hard code special values