Yes, you can.
Inside your c program just call the "system(your_commnad)" .
Remember you have to run this program as supper user.
printf("Going to shutdown the system....\n");
It will execute the "shutdown" command from the c program.
You can provide "poweroff" in the place of "shutdown".
To know more about system(), do a <man 3 system>.
system("shutdown -P now"); // see man shutdown for more options.