- Keywords and identifiers
- Integral types
- Arithmetic Operators in C
- If statements in C
- C - if...else statement
- Relational Operators in C
- C – Logical Operators
- while loop in C
- while loop
Positive anything is better than negative nothing
This program will assign a random number to the variable n
each time it is executed. Complete the source code in order to print whether the number stored in the variable n
is positive or negative.
- You can find the source code here
- The variable
n
will store a different value every time you will run this program - You don’t have to understand what
rand
,srand
,RAND_MAX
do. Please do not touch this code - 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
The last digit
This program will assign a random number to the variable n
each time it is executed. Complete the source code in order to print the last digit of the number stored in the variable n
- You can find the source code here
- The variable
n
will store a different value every time you run this program - You don’t have to understand what
rand
,srand
, andRAND_MAX
do. Please do not touch this code - 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 stringand is 0
- if the last digit of
n
is less than 6 and not 0: the stringand is less than 6 and not 0
- if the last digit of
- followed by a new line
- The string
The last digit
A program that prints the alphabet in lowercase, followed by a new line.
- 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
twice in your code
alphABET
A program that prints the alphabet in lowercase, and then in uppercase, followed by a new line.
- 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
three times in your code
When I was having that alphabet soup, I never thought that it would pay off
A program that prints the alphabet in lowercase, followed by a new line.
- Print all the letters except
q
ande
- 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
three times in your code
Numbers
Write a program that prints all single digit numbers of base 10 starting from 0
, followed by a new line.
- All your code should be in the
main
function.
Numberz
A program that prints all single digit numbers of base 10 starting from 0
, followed by a new line.
- You are not allowed to use any variable of type
char
- 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
three times in your code
Smile in the mirror
A program that prints the lowercase alphabet in reverse, followed by a new line.
- 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
three times in your code
Hexadecimal
A program that prints all the numbers of base 16 in lowercase, followed by a new line.
- 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
three times in your code
Patience, persistence and perspiration make an unbeatable combination for success
A program that prints all possible combinations of single-digit numbers.
- 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
three times in your code
Inventing is a combination of brains and materials. The more brains you use, the less material you need
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 digits0
and1
- 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) - All your code should be in the
main
function - You can only use
putchar
three times in your code
The success combination in business is: Do what you do better... and: do more of what you do...
A program that prints all possible different combinations of three digits.
- 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 digits0
,1
and2
- 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) - All your code should be in the
main
function - You can only use
putchar
three times in your code
Software is eating the World
A program that prints all possible combinations of two two-digit numbers.
- The numbers should range from
0
to99
- The two numbers should be separated by a space
- All numbers should be printed with two digits.
1
should be printed as01
- The combination of numbers must be separated by comma, followed by a space
- The combinations of numbers should be printed in ascending order
00 01
and01 00
are considered as the same combination of the numbers0
and1
- 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
three times in your code - All your code should be in the
main
function