Pattern 11

 avatar
user_6679955
c_cpp
2 months ago
258 B
3
Indexable
void nBinaryTriangle(int n) {
    for(int i=0;i<n;i++){
        for(int j=0;j<=i;j++){
            if(i%2==j%2){
                cout<<1<<" ";
            }
        else{
            cout<<0<<" ";
        }

        }
        cout<<endl;
    }
}
Editor is loading...
Leave a Comment