Computer Science, asked by fahmeedayousuf4163, 11 months ago

how to print a pattern of binary numbers

Answers

Answered by garywalter1221
0

#include<stdio.h>

 

int main() {

  int i, j;

  int count = 1;

 

  for (i = 1; i <= 4; i++) {

     printf("\n");

     for (j = 1; j <= i; j++) {

        printf("%d", count % 2);

        count++;

     }

 

     if (i % 2 == 0)

        count = 1;

     else

        count = 0;

  }

  return(0);

}

hope it will help u

Similar questions