reverse hollow triangle
Fri Oct 20 2023 14:06:36 GMT+0000 (Coordinated Universal Time)
Saved by
@yolobotoffender
#include <iostream>
#include<iomanip>
using namespace std;
int main() {
int num;
cout<<"enter a number";
cin>>num;
for(int r=1;r<=num;r++){
for(int s=0;s<=r-1;s++){
cout<<' ';}
for(int c=1;c<=2*num-2*r+1;c++){
if(r==1){cout<<'*';}
else if(c==r || c==2*num-2*r+1){cout<<'*';}
else {cout<<' ';}
}
cout<<endl;
}
return 0;
}
content_copyCOPY
Comments