To check whether the given no. is prime (or) not

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
    int i, n, flag = 0;
    clrscr();
    printf("Enter the Number : ");
    scanf("%d", &n);
    if(n <= 3)
    flag = 0;
    else
    {
        for(i = 2 ; i <= n / 2 ; i++)
        if(n % i == 0)
        {
            flag = 1;
            break;
        }
    }
    if(flag == 1)
    printf("\nThe number is not prime");
    else
    printf("\nThe number is prime");
    getch();
}

Output:

Case: 1

Enter the Number : 6
The number is not prime

Case: 2

Enter the Number : 11
The number is prime