C program to print all odd numbers from 1 to n using while

#include<stdio.h>
int main()
{
	int i, n;


	printf("Enter to print all odd numbers till: ");
	scanf("%d",&n);

	while(i<=n)
	{
		if(i%2 != 0)
		{
			printf("%d\n",i);
		}
		i++;
	}

	return 0;
}

Output

Enter to print all odd numbers till: 11
1
3
5
7
9
11