write a program to display the pattern:-
1
01
101
0101
10101
Answers
Answered by
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
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
Science,
2 months ago
Chemistry,
2 months ago
English,
5 months ago
Political Science,
11 months ago