C Program to print prime numbers within given range

Program

#include<stdio.h>
void main()
{
	int i, n, m;
	printf("Enter the range (m < n):\t");
	scanf("%d %d", &m, &n);
	while(m <= n)
	{
		for(i = 2; i <= m; i++)
		{
			if(m % i == 0)
				break;
		}
		if(i == m)
			printf("%d\t", m);
		m++;
	}
	printf("\n");
}

Output

Enter the range (m < n):	12
40
13	17	19	23	29	31	37