Preview:
#include <iostream>
#include <cmath>
using namespace std;
int main(){
    int x,n,y,hor_s;
 
 cout<<"value of x:  ";
 cin>>x;
 cout<<"input vlue of n:  ";
 cin>>n;
    //equation of y is:
y = pow(x, n) + pow(x,n-1);
for(y;y>= 0;y -= 2){
   if(y == pow(x,n) + pow(x,n-1)){
       for (int s=1;s<=(x*2)+1;s++){
           cout<<' ';
       }
cout<<'*';
x--; 
   }
else    
{
    cout<<' ';
}

  cout<<endl;
}                        
   y = pow(hor_s,n) + pow(hor_s,n-1);
   for(int i=0;i<=hor_s;i++){
       if(i==0){cout<<"   "<<i;}
       else if(i>=1 && i<=9){cout<<' '<<i;}
       else if(i>=10 && i<=99){cout<<"  "<<i;}
   }
    
    
    

 
    return 0;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter