1 solutions

  • 0
    @ 2025-11-5 16:30:46

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    long long n;
    int main()
    {
    	cin>>n;
        for(int i=1,j=n-1,k=1;i<=n;i++,j--,k+=2)
        {
        	for(int o=1;o<=j;o++)
        	cout<<' ';
        	for(int o=1;o<=k;o++)
        	cout<<'*';
        	cout<<endl;
    	 } 
        return 0;
    }
    

    Pascal :

    var n,i,j:longint;
    begin
      readln(n);
      for i:=1 to n do
          begin
            write('':n-i);
            for j:=1 to i*2-1 do write('*');
            writeln;
          end;
    end.
    
    
    • 1

    Information

    ID
    17816
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By