print all odd numbers between 1 to 100 with C
#include <stdio.h>
int main()
{
int i, N;
printf("Enter Last Number N : ");
scanf("%d", &N);
printf("All odd numbers from 1 to %d are: \n", N);
for (i = 1; i <= N; i++)
{
if (i % 2 != 0)
{
printf("%d ", i);
}
}
return 0;
}
Output:-
Enter Last Number N : 20
All odd numbers from 1 to 20 are :
1 3 5 7 9 11 13 15 17 19
0 Comments