title: execute user input as shell command in C
body: <p>can any one tell me how to execute input of c program as command in shell?</p>
  
  <p>I tried with the following code</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  
      void main()
      {
      int year,month;
      system("date");
      printf("Enter the month and year\n");
      scanf("%d%d",&amp;month,&amp;year);
      system("cal &amp;&amp;");
      printf("%d %d",month,year);
      system("ls");
      system("ps");
      }
  </code></pre>
  
  <p>it has to print the calender of month and year provided by user</p>
  
  <p>thank you</p>