Activity - C
Goals
To experience use of mygcc
to compile C programs and to use editor to edit a C program.
Task
- Copy the
guessprime
program into your own directory on plank, and compile it:
cp /thayerfs/courses/22fall/cosc050/workspace/activities/day6/guessprime4.c guessprime.c
mygcc -o guessprime guessprime.c
- Edit
guessprime.c
to add and call a new function:
// print the list of prime numbers from min to max inclusive
void listPrimes(const int min, const int max);
and arrange to call it when the player gets the right answer:
Enter a prime between 1-100: 31
You win! here's a list of primes in [1..100]:
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97