Command Line Program for Checking Prime or Not

Note: Please go through Command Line Arguments Post before preparing for these questions. The theory there  for TCS command line Program will help you in better understanding .

#include <stdio.h>

int main(int argc, char *argv[])

{

             int n, i, flag = 0;

             n = atol(argv[1]);

            for(i=2; i<=n/2; ++i)

   {

            if(n%i==0)

      {

            flag=1;

            break;

      }

   }

   if (flag==0)

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

   else

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

   return 0;

}