Today I’m gonna share a small piece of c program to shutdown computer. It won’t take more than a minute to code and compile it. Moreover a newbie C programmer who knows some basics in C program can understand this program.
You may also like Top 25+ Websites to Learn Programming Online
Below is the source code to shutdown computer using C Program
1 2 3 4 5 6 7 8 |
#include<stdio.h> #include<process.h> #include<windows.h> int main() { system(“shutdown -s -t 30″); return 0; } |
I tried this code in Dev C++ and its working for me.
Note : When you compile and run this program it will only show empty screen and system won’t shutdown. You need to open compile file (filename.exe) directly
How about you?
Did you tried this code?
Any suggestions?
Come and share your thoughts in commends below.
sunny says
i m very existed for programming m expert in c language and m 17 years old………….
Ashik Nesin says
Thanks for coming by and commending 🙂
[email protected] says
Thanks.As i am learning C.This is very informative.Keep it up:-)
Ashik Nesin says
Hi Gowtham,
I’m so glad that you like this article. Do visit us again 🙂
Mpalaganyi Mark says
Am glad that i can now learn programming on my own, thax
Abby says
Very informative post indeed.. your post helped me a lot!
Mike says
Just needed to do that for a small project of mine. You’re a life-saver dude!
thanesh says
Can i get source code to shutdown pc from android ?
Ashik Nesin says
I’m not sure about it.
Most probably you can do it.