AshikNesin.com

Notes on Tech & Life

  • Home
  • Programming
  • Tutorials
  • Make Money
  • About
  • Contact
You are here: Home / Programming / How To Shutdown computer using C Program

How To Shutdown computer using C Program

By Ashik Nesin 9 Comments

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

 

Shutdown Computer using C
C
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.

  • Facebook
  • Twitter
  • Google+
  • StumbleUpon
  • Buffer

Recommended Guides for you

  • Top 25+ websites to Learn Programming OnlineTop 25+ websites to Learn Programming Online
  • 6 Ways to Learn Programming Language Efficiently6 Ways to Learn Programming Language Efficiently
  • How to create antivirus in 60 SecondsHow to create antivirus in 60 Seconds
  • How to Create fake virus using NotepadHow to Create fake virus using Notepad

Filed Under: Programming Tagged With: C, Programming

About Ashik Nesin

Founder of HugeThoughts. I've been freelancing for many years and now focuses on providing quality resources &tutorials that I hope others find interesting too..
Contact me anytime for anything- I’d love to hear from you!

Comments

  1. sunny says

    November 14, 2011 at 3:26 pm

    i m very existed for programming m expert in c language and m 17 years old………….

    Reply
    • Ashik Nesin says

      November 16, 2011 at 11:43 am

      Thanks for coming by and commending 🙂

      Reply
  2. [email protected] says

    February 29, 2012 at 2:12 pm

    Thanks.As i am learning C.This is very informative.Keep it up:-)

    Reply
    • Ashik Nesin says

      March 3, 2012 at 9:22 am

      Hi Gowtham,

      I’m so glad that you like this article. Do visit us again 🙂

      Reply
  3. Mpalaganyi Mark says

    September 14, 2012 at 6:38 pm

    Am glad that i can now learn programming on my own, thax

    Reply
  4. Abby says

    October 17, 2012 at 1:43 pm

    Very informative post indeed.. your post helped me a lot!

    Reply
  5. Mike says

    May 17, 2013 at 10:11 pm

    Just needed to do that for a small project of mine. You’re a life-saver dude!

    Reply
  6. thanesh says

    July 1, 2015 at 6:54 am

    Can i get source code to shutdown pc from android ?

    Reply
    • Ashik Nesin says

      July 1, 2015 at 8:00 pm

      I’m not sure about it.

      Most probably you can do it.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Articles

  • How To Record Your iPhone Screen in 3 Easy Steps
  • Official Link to Download Mozilla Firefox Standalone Offline Installer [Latest ]
  • How to Automatically Login to Windows 8.1/10 in 60 Seconds
  • How to create Self-Destruction program in C/C++
  • Top 5 open-source alternative for Photoshop
Copyright © 2020 · – till the end of time, Ashik Nesin