5 f.) Program to print

 

/*program to print the
1
01
101
0101
10101*/
#include<stdio.h>
#include<conio.h>
int main()
{
    int i,j,n=1;
    for(i=1;i<=5;i++)
    {
        for(j=1;j<=i;j++)
        {
            if((i+j)%2==0)
            {
                printf("1");
            }
            else
            {
                printf("0");
            }
        }
        printf("\n");
    }
    return 0;
}

Output:-
1 01 101 0101 10101
***** Thank you ******

Comments

Popular posts from this blog

18 Amazing programs in C.