You are on page 1of 2

10 Programming with C Coding Exercises

By Dan Gookin from Beginning Programming with C For Dummies


If you're just beginning with C programming, test your skills with these projects. Answers for these exercises
are not provided on the website. It's up to you to complete them, using your knowledge of C. Good luck!
Project 1
Create a program that grabs a string of text and then totals the values of all characters in the string (as integers).
Project 2
Create a program that displays the first 100 prime numbers.
Project 3
Create a program that draws five random numbers, like a Lotto drawing. Ensure that the same number isn't drawn
twice.
Project 4
Create a program that reads words from a text file and reassembles the words in random order.
Project 5
Create a program that simulates a deck of cards. Draw five cards from the deck.
Project 6
Create a program that reads standard input and sends to standard output the hexadecimal values of the characters
input, separated by spaces.
Project 7
Create a program that simulates the roll of a die. Have the program output the rolls of six dice repeatedly until at least
four of the dice roll the same number.
Project 8
Create a program that reads a directory, storing information on each of the files in a structure. The structures are then
displayed and sorted by file size, from smallest to largest.
Project 9
Code a program that takes the value of a long int and rotates the bit values so that the new value has bits set from
left to right rather than from right to left. For example, if the original value is01010011, the output is 11001010.
Project 10
Write a program with a function that converts a string of digits into an integer value. Do not use
thestrtol() function or any other standard C library function. Write your own!

You might also like