Write a C program to print the pattern 1 01 101 0101 10101?

1 answer

Answer

1051653

2026-04-28 13:30

+ Follow

#include<stdio.h>

#include<conio.h>

void main()

{

int i,j,k=0,l;

clrscr();

for(i=1;i<=5;i++)

{

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

{

k++;

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

}

for(l=i;l<=4;l++)

{

k++;

}

printf("\n");

}

getch();

}

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.