Computer Science, asked by vaishnavijaiswal4049, 2 months ago

write a program to display the pattern:-
1
01
101
0101
10101​

Answers

Answered by Misscottoncandy6
3

Answer:

#include<stdio.h>

#include<conio.h>

void main()

{

int i,j,n;

clrscr();

printf("\n Enter the value of n:");

scanf("%d",&n);

for(i=0;i<=n;i++)

{

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

 {

  if((i+j)%2==0)

  {

 printf("\t 0");

  }

else

{

 printf("\t 1");

}

 }

printf("\n");

}

getch();

}

Explanation:

please mark me as brainliest

Attachments:
Answered by Anonymous
4

Answer:

Program to print following pattern-

1  

01

101

0101

10101

*/ #include<conio.h>  void main() { int i,j,n;

clrscr(); printf("\n Enter the value of n:"); scanf("%d",&n); for(i=0;i<=n;i++)  

{ for(j=1;j<i;j++) { if((i+j)%2==0){ printf("\t 0"); }

else

{ printf("\t 1"); } }  printf("\n"); } getch();

Explanation:

plaese mark me as brainliest

Similar questions