SCRIPT TO CREATE A CHILD PROCESS AND EXECUTE LINUX COMMANDS

SCRIPT TO CREATE A CHILD PROCESS AND EXECUTE LINUX COMMANDS 
#include<unistd.h>
#include<stdio.h>
#include<stdlib.h>
#include<sys/wait.h>
#include<sys/types.h>
main()
{
int i,x;

char cmd[10];
x=fork();
if(x>0)
do
{
printf("enter the command");
scanf("%s",cmd);
system(cmd);
printf("enter 1 to continue o for exit");
scanf("%d",&i);
}while(i!=0);
if(wait(0)==x)
printf("child terminated");
}