This program will shut down or turn off your computer. When you execute this program on your machine it will immediately shut down your computer.
In this tutorial, you will find the difference program in c programming language for different operating systems like Windows XP, Windows 7, and Ubuntu.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#include <stdio.h> #include <stdlib.h> int main() { char ch; printf("Do you want to shutdown your computer now (y/n)\n"); scanf("%c", &ch); if (ch == 'y' || ch == 'Y') system("C:\\WINDOWS\\System32\\shutdown -s"); return 0; } |
1 2 3 4 5 6 7 8 9 |
#include <stdio.h> #include <stdlib.h> int main() { system("C:\\WINDOWS\\System32\\shutdown /s"); return 0; } |
1 2 3 4 5 6 |
#include <stdio.h> int main() { system("shutdown -P now"); return 0; } |
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: c program, c program examples, c program examples with output