Monday, 5 October 2015

Program to print odd/even number Patterns.

  
   
#include<stdio.h>
//#include<conio.h>
#include
//#include
void main() {
    int i, j, l, k = 0;
    //clrscr();
    for (i = 1; i <= 4; i++) {
        for (j = 1; j <= i; j++) {
            k++;
            printf("%d", k % 2);
        }
        for (l = i; l <= 4; l++) {
            k++;
        }
        printf("\n");
    }
    //getch();
}
Note: Remove the comment line when you are use Turbo C IDE for run your program.

No comments:

Post a Comment