Program to print triangle Binary Pattern using 0 & 1 numbers for n number of lines.[Pattern:9]| Using C language| C Program series 30|
👨💻Program to print palindrome triangle Binary Pattern (◣) using 0 & 1 numbers for n number of lines.[Pattern:9]
Code :
For n number of LINES:
/*
[Pattern:9]Program to print triangle Binary Pattern using 0 & 1 numbers for n number of lines.
For Example:n=5
1
01
101
0101
10101
*/
#include<stdio.h>
main()
{
printf("[Pattern:9]Program to print triangle Binary Pattern using 0 & 1 numbers for n number of lines.\n\n");
int i,j,n,k=1;
//Here,
//n for number
//i for row
//j for colomn
printf("Enter the number:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(i%2==0)
{
k=0;
}
else
{
k=1;
}
for(j=1;j<=i;j++,k++)
{
if(k%2!=0)
{
printf("1");
}
else
{
printf("0");
}
}
printf("\n");
}
}
The output of Code:
![Program to print triangle Binary Pattern using 0 & 1 numbers for n number of lines.[Pattern:9]| Using C language| C Program series 30|](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjicPHzmo-XLraJ2_6epozwBMTrwjgeAUfoKSQED_u7IkKwbwsk8H7yVSWP94H3JiLzcBm-ktUEgXwh8awyHJcDaS4u8ovmZ1AQnRtFlht_z6ol9ckrxF2E2vH2rePHE30nmhRPPl5F2T-_2qiksFPLkMO9CiSpHHLtG81Gc37rFCASEg8n6HhyUq8/w640-h140/Screenshot%202022-10-21%20204334.jpg)
![Program to print triangle Binary Pattern using 0 & 1 numbers for n number of lines.[Pattern:9]| Using C language| C Program series 30|](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMfE58yFkQ2hIRXKMIw14RBhpS1ISYNOgB5zTUMI1afrQAqjSUDegZYSuyzi2vSPOjnkJE4Gb9nr2Gkw7Aj8tVFK_rleLVPTrOf6Sfz5qlPEpT7rPnfo8AC8xs-D0JdLkkmtJyeo32CcDCelLM2gVWEezgL5NEeGLa1ukYet9HSgdxeQQG-6C7H6E/w640-h198/Screenshot%202022-10-21%20204355.jpg)
![Program to print triangle Binary Pattern using 0 & 1 numbers for n number of lines.[Pattern:9]| Using C language| C Program series 30|](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDDmhrk1fMTa9Haq3h7KI60TKtGu_G6CWC94VseYH5XiRjSCikHKJdGyWMZfBeBFopZVvDc3JWl4lr6PsB3Ys03WmEIAHZ-dUlsJYZAOJwDDve3mZiyoOnsz0Jzxv1-U0ZucOQ_3KoSa5cHhd7-MQYBURi8Rm_gpgJg7CqASlVw2Stm_ko0Arv9jg/w640-h312/Screenshot%202022-10-21%20204413.jpg)
Comments
Post a Comment