C Programming Homework #7: Sieve of Eratosthenes

Due: Monday, March 14, 2016

Read Lesson #18 in my C tutorial.

  1. Write a program that finds prime numbers using the Sieve of Eratosthenes. It should create an array of 100 integers, all initialized to 1 (true). It should then falsify multiples of each value. For example, starting at 2, it should falsify 4, 6, 8, etc. Then starting at 3, it should falsify 6, 9, 12, etc. When it is done processing all the values, print the remaining true integers as primes.

    Be careful to always access the array in bounds!

Submit your program to Moodle (the .c file). Be sure it includes a comment block at the top that includes your name, the name of the file, the date, and a brief description of what the program does..


Last Revised: 2016-03-08
© Copyright 2016 by Peter C. Chapin <PChapin@vtc.vsc.edu>