Program Membuat Bentuk Segitiga Sama Sisi



#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;

int main(int argc, char** argv) {

int x,i,j,k;

cout<<"\t\tMembuat Bentuk Segitiga Sama Sisi";
cout<<endl;
cout<<"Masukkan tinggi : ";
cin>>x;
for(i=1;i<=x;i++)
{
for(j=x;j>=i;j--)
{
cout<<" ";
}
for(k=1;k<=i+(i-1);k++)
{
cout<<"*";
}
cout<<endl;
}

return 0;
}



Comments