I have a sample C program for addition. When I compile and run it with GCC it is using only one CPU core.
Is there any way to compile a C program so that it can use
You need to create several threads. Otherwise there is only one thread, and it runs on a single core (at a time).
Look at a tutorial about threads, specifically pthreads, to find out how to work with threads. Or you could use the fork system call to split your program into several processes, with one thread each.