Command Line Program to Check if a Number is Prime or Not

It is highly advisable to go through Command Line Arguments Post before even looking at the code. Please study this for TCS and come back to this post later

#include 
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;
}