Write a C program to generate all the prime numbers between 1 and n, where n is a value supplied by the user.