Follow This Blog For more... 😊

Program to print 0-1 Pattern using C++

Program to print 0-1 Pattern using C++. 

CODE;


    #include<iostream>
    using namespace std;

    main()
    {
        int i,j,n,c;
       
        cout<<"Enter the number:";cin>>n;
       
        for(i=1;i<=n;i++)
        {
            c=i;
            for(j=1;j<=i;j++)
            {
                cout<<c%2<<" ";
                c++;
            }
            cout<<endl;
        }
    }

Output:




Comments

Popular Posts