Here is source code of the C Program to shutdown or turn off the computer in linux. The C program is successfully compiled and run on a Linux system. The program output is also shown below.
* C Program to Shutdown or Turn Off the Computer in Linux.
system("shutdown -P now");
$ cc pgm57.c $ a.out shutdown: Need to be root
Sanfoundry Global Education & Learning Series – 1000 C Programs.