how to print a pattern of binary numbers
Answers
Answered by
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
Math,
7 months ago
India Languages,
7 months ago
Biology,
7 months ago
Chemistry,
1 year ago
English,
1 year ago