In this project, I learned about using arithmetic, logical, relational, and boolean operators in C. Additionally, how to declaring and defining variables of type char
, int
, and unsigned int
, and learned how to use if
and if...else
statements, and implementing while loop
.
-
- 0-positive_or_negative.c :C program that prints whether a randomly generated number is positive or negative, followed by a new line:
- Completion of this source code.
- The variable n will store a different value every time you will run this program.
- The output of the program should be:
- The number, followed by
- if the number is greater than 0:
is positive
- if the number is 0:
is zero
- if the number is less than 0:
is negative
- if the number is greater than 0:
- followed by a new line.
- The number, followed by
- 0-positive_or_negative.c :C program that prints whether a randomly generated number is positive or negative, followed by a new line:
-
- 1-last_digit.c :C program that prints the last digit of a randomly generated number, followed by a new line:
- Compilation of this source code.
- The variable
n
will store a different value every time you run this program. - The output of the program should be:
- The string
Last digit of
, followed by n
, followed by- the string
is
, followed by- if the last digit of
n
is greater than 5: the string andis greater than 5
. - if the last digit of
n
is 0: the string andis zero
- if the last digit of
n
is less than 6 and not 0: the string andis less than 6 and not 0
- if the last digit of
- followed by a new line
- The string
- 1-last_digit.c :C program that prints the last digit of a randomly generated number, followed by a new line:
-
2. I sometimes suffer from insomnia. And when I can't fall asleep, I play what I call the alphabet game
- 2-print_alphabet.c :C program that prints the alphabet in lowercase, followed by a new line, using only the
putchar
function exactly.
- 2-print_alphabet.c :C program that prints the alphabet in lowercase, followed by a new line, using only the
-
- 3-print_alphabets.c :C program that prints the alphabet in lowercase, then in uppercase, followed by a new line, using only the
putchar
function exactly three times.
- 3-print_alphabets.c :C program that prints the alphabet in lowercase, then in uppercase, followed by a new line, using only the
-
- 4-print_alphabt.c :C program that prints the alphabet in lowercase except for the letters
q
ande
, followed by a new line, using only theputchar
function exactly twice.
- 4-print_alphabt.c :C program that prints the alphabet in lowercase except for the letters
-
- 5-print_numbers.c :C program that prints all single digit numbers of base 10 starting from
0
, followed by a new line.
- 5-print_numbers.c :C program that prints all single digit numbers of base 10 starting from
-
- 6-print_numberz.c :C program that prints all single digit numbers of base 10 starting from
0
, followed by a new line, using only theputchar
function exactly twice without any variables of type char.
- 6-print_numberz.c :C program that prints all single digit numbers of base 10 starting from
-
- 7-print_tebahpla.c :C program that prints the lowercase alphabet in reverse, followed by a new line, using only the
putchar
function exactly twice.
- 7-print_tebahpla.c :C program that prints the lowercase alphabet in reverse, followed by a new line, using only the
-
- 8-print_base16.c :C program that prints all the numbers of base 16 in lowercase, followed by a new line, using only the putchar function exactly three times.
-
- 9-print_comb.c :C program that prints all possible combinations of single-digit numbers, using only the
putchar
function exactly four times without any variables of type char:- Numbers must be separated by
,
, followed by a space - Numbers should be printed in ascending order
- You can only use the
putchar
function (every other function (printf
,puts
, etc…) is forbidden) - All your code should be in the
main
function - You can only use
putchar
four times maximum in your code - You are not allowed to use any variable of type
char
- Numbers must be separated by
- 9-print_comb.c :C program that prints all possible combinations of single-digit numbers, using only the
-
10. Inventing is a combination of brains and materials. The more brains you use, the less material you need
- 10-print_comb2.c: Write a program that prints all possible different combinations of two digits.
- Numbers must be separated by
,
, followed by a space - The two digits must be different
01
and10
are considered the same combination of the two digits 0 and 1- Print only the smallest combination of two digits
- Numbers should be printed in ascending order, with two digits
- You can only use the
putchar
function (every other function (printf
,puts
, etc…) is forbidden) - You can only use
putchar
five times maximum in your code - You are not allowed to use any variable of type
char
- All your code should be in the
main
function
- Numbers must be separated by
- 10-print_comb2.c: Write a program that prints all possible different combinations of two digits.
-
- 100-print_comb3.c :C program that prints all possible different combinations of two digits using only the
putchar
function exactly five times without any variables of typechar
:- Numbers must be separated by
,
, followed by a space - The three digits must be different
- 012, 120, 102, 021, 201, 210 are considered the same combination of the three digits 0, 1 and 2
- Print only the smallest combination of three digits
- Numbers should be printed in ascending order, with three digits
- you can only use the putchar function (every other function (printf, puts, etc…) is forbidden)
- You can only use
putchar
six times maximum in your code - You are not allowed to use any variable of type
char
- All your code should be in the
main
function
- Numbers must be separated by
- 100-print_comb3.c :C program that prints all possible different combinations of two digits using only the