by: Yogi Nazrul Huda
122406136
#include<iostream.h>
#include<conio.h>
int main()
{
int j,k,l,m;
cout<<"Masukkan segitiga : ";
cin>>m;
for(j=0;j<=m;j++)
{
for(k=0;k<=j;k++)
{
cout<<" ";
}
for(l=0;l>=(j-m);l--)
{
cout<<"*";
}
for(l=0;l<(m-j);l++)
{
cout<<"*";
}
cout<<endl;
}
system("pause");
return 0;
}
Program Mnggunakan Do-while
#include<iostream.h>
#include<conio.h>
using namespace std;
int main()
{
int j,k,l,m;
do {
cout<<"Masukkan segitiga : ";
cin>>m;
}
while(m>j);
for(j=0;j<=m;j++)
{
for(k=0;k<=j;k++)
{
cout<<" ";
}
for(l=0;l>=(j-m);l--)
{
cout<<"*";
}
for(l=0;l<(m-j);l++)
{
cout<<"*";
}
cout<<endl;
}
system("pause");
}
#include<conio.h>
using namespace std;
int main()
{
int j,k,l,m;
do {
cout<<"Masukkan segitiga : ";
cin>>m;
}
while(m>j);
for(j=0;j<=m;j++)
{
for(k=0;k<=j;k++)
{
cout<<" ";
}
for(l=0;l>=(j-m);l--)
{
cout<<"*";
}
for(l=0;l<(m-j);l++)
{
cout<<"*";
}
cout<<endl;
}
system("pause");
}
NO COPAS TANPA LINK>>>>!!!!!!!!
THNKS.,,,,,,,,,,
THNKS.,,,,,,,,,,