int i;
for(i=1; i<=30; i+=2) {
printf("%d\n",i);
}
}
Output:
1
3
.
.
.
27
29
}
Output:
1
3
.
.
.
27
29
How it works
Runs by adding 2 on each loop which skips even digits.
1
1 + 2 = 3
3 + 2 = 5
...
27 + 2 = 29
As we need result up to 30, it will only shows output of odd numbers.