source file name: Primecmd.C

// command line program main method have 2 parameters

void main(int a, char *b[])

{

void prime(int); // prototype of function

int n;

//clrscr();

n=atoi(b[1]);


printf("\n given  no :  %d ",n);


prime(n);


getch();

}


void prime(int n)

{

int d=2;

while(d<n)

{

if(n%d==0)

{

printf("\n %d is not prime number", n);

break;

}

else

d++;

}

if(n==d)

printf("\n %d is prime number", n);

}


output: