Thursday 10 June 2021

Pattern

 Pascal Triangle-


#include<bits/stdc++.h>
using namespace std;

int main()
  
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    vector<int>cur(n+1),prev(n+1);
    for(int i=1;i<=n;i++)
    { 
      prev[0]=1;
      for(int j=1;j<=i;j++)
      {
        if(j==1||j==i)
          cur[j]=prev[j-1];
        else
          cur[j]=prev[j]+prev[j-1];
        cout<<cur[j]<<" ";

      }
      cout<<"\n";
      swap(cur,prev);
    }
    
    
}


Full Pyramid Pattern-

 


#include<bits/stdc++.h>
using namespace std;
int main()
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int k=1;
    for(int i=1;i<=n;i++)
    {
      int sp=n-i;
      for(int j=0;j<sp;j++)cout<<" ";
      int tm=k;
      k+=2;
      for(int j=0;j<tm;j++)cout<<"*";
      cout<<"\n";
    }
    
}



ButterflyPattern-



The Future of Web Development: Why Next.js is Going Viral

  Are you ready to level up your web development game? Look no further than Next.js, the latest sensation in the world of web development th...