What's new

Help Pa help po sa pattern mga sir

EEEEERRRRRAAAA

Honorary Poster
Joined
Oct 28, 2018
Posts
442
Reaction
48
Points
248
Age
25
1623999285918.png
 

Attachments

c++ Code:

C++:
#include <iostream>
using namespace std;
int main(void) {
    for(int i=1; i<=5; i++){//do print each rows
        for(int j=i; j<=5; j++){ //print space for pyramid
        cout<<" ";
    }
    for(int k=1; k<2*i; k++){
            if(i==5 || (k==1 || k==2*i-1)){
                cout<<"&";
            }
            else{
                cout<<" ";
            }
    }
    cout<<"\n"; //move to next line
    }
}

Output:

1624000216249.png
 

Attachments

c++ Code:

C++:
#include <iostream>
using namespace std;
int main(void) {
    for(int i=1; i<=5; i++){//do print each rows
        for(int j=i; j<=5; j++){ //print space for pyramid
        cout<<" ";
    }
    for(int k=1; k<2*i; k++){
            if(i==5 || (k==1 || k==2*i-1)){
                cout<<"&";
            }
            else{
                cout<<" ";
            }
    }
    cout<<"\n"; //move to next line
    }
}

Output:

View attachment 1464735
thank you po sir
 

Compiler: Devcpp​

c++ Code:​

C++:
#include <iostream>
using namespace std;
int main(void) {
    for(int i=1; i<=5; i++){//do print each rows
        for(int j=i; j<=5; j++){ //print space for pyramid
        cout<<"  ";
    }
    for(int k=1; k<2*i; k++){
            if(i==5 || (k==1 || k==2*i-1)){
                cout<<"& ";
            }
            else{
                cout<<"  ";
            }
    }
    cout<<"\n"; //move to next line
    }
}

Output:

1624003030540.png
 

Attachments

Similar threads

Back
Top