C program to print the even numbers
kw.c
#include <stdio.h> int main() { int i; for (i = 0; i <= 10; i++) { printf("%d\n", i); i++; } }
Output
kodingwindow@kw:~$ gcc kw.c
kodingwindow@kw:~$ ./a.out 0 2 4 6 8 10 kodingwindow@kw:~$
C program to print the odd numbers
kw.c
#include <stdio.h> int main() { int i; for (i = 1; i <= 10; i++) { printf("%d\n", i); i++; } }
Output
kodingwindow@kw:~$ gcc kw.c
kodingwindow@kw:~$ ./a.out 1 3 5 7 9 kodingwindow@kw:~$
Comments and Reactions
What Next?
C program to print the star pyramid patterns
C program to print the star diamond pattern
C program to print the alphabets diamond pattern
Advertisement