using nested loops try producing the following patterns ...
a.
1
01
101
0101
10101
b.
12345
2345
345
45
5
plz no spam
Answers
Answered by
0
Explanation:
1:-
#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();
}
2:-
#include <stdio.h>
int main()
{
int i, j, N;
printf("Enter N: ");
scanf("%d", &N);
for(i=1; i<=N; i++)
{
// Logic to print numbers
for(j=i; j<=N; j++)
{
printf("%d", j);
}
printf("\n");
}
return 0;
}
Similar questions