4 solutions

  • 2
    @ 2024-4-1 11:19:22
    #include <iostream>
    
    using namespace std;
    
    int main(){
    	char a;
    	cin>>a;
    	for (int i=1;i<=5;i++){ 
    		if (i%2==0){
    			continue;
    		}
    		for (int j=1;j<=(5-i)/2;j++){
    			cout<<" ";
    		}
    		for (int j=1;j<=i;j++){
    			cout<<a;
    		}
    		cout<<"\n";
    	}
    }
    
    • 1
      @ 2024-4-3 22:23:16

      #include

      using namespace std;

      int main(){ char a; cin>>a; for (int i=1;i<=5;i++){ if (i%2==0){ continue; } for (int j=1;j<=(5-i)/2;j++){ cout<<" "; } for (int j=1;j<=i;j++){ cout<<a; } cout<<"\n"; } }

      • 1
        @ 2024-4-3 22:16:42
        a=input();
        for i in range(1,4):
            b=' '*(3-i)
            print(b,end='')
            for j in range(i*2-1):
                print(a,end='')
            print('')
        
        • 1
          @ 2024-3-18 12:13:58
          #include <iostream>
          
          using namespace std;
          
          int main(){
          	char a;
          	cin>>a;
          	for (int i=1;i<=5;i++){ 
          		if (i%2==0){
          			continue;
          		}
          		for (int j=1;j<=(5-i)/2;j++){
          			cout<<" ";
          		}
          		for (int j=1;j<=i;j++){
          			cout<<a;
          		}
          		cout<<"\n";
          	}
          }
          
          • 1

          Information

          ID
          6766
          Time
          1000ms
          Memory
          128MiB
          Difficulty
          1
          Tags
          # Submissions
          81
          Accepted
          43
          Uploaded By