Program C++: Program Segitiga Sama Kaki
created by. Muhammad 'Ariful Furqon
Screen Shot:
Script:
#include <iostream.h>
#include <conio.h>
void main()
{
cout << endl;
int n, a, b, c, e, f, i, j, k;
cout << "\t\t +++++++++++++++++++++++++++++++\n";
cout << "\t\t + Program Segitiga sama kaki +\n";
cout << "\t\t +++++++++++++++++++++++++++++++\n";
cout << "\t\t Created by. M. 'Ariful Furqon\n";
cout << "\t\t 120533430912\n";
cout << "\t\t PTI offering B 2012\n";
cout << endl;
cout << "===================================================================\n";
cout << "Masukkan tinggi segitiga : ";
cin >> n;
cout << "===================================================================\n";
for (a = 1; a <= n; a++)
{
b = a - 1;
for ( c = 1; c <= b; c++)
{
cout << " ";
}
b = (2 * n) - (2 * a - 1);
for (c = 1; c <= b; c++)
{
cout << "\3";
}
cout << endl;
}
for( e = 1;e<=n-1;e++)
{
for(f=1;f<=e;f++)
{
cout<<"\3";
}
cout<<endl;
}
for (e=n;e>=1;e--)
{
for(f=e;f>=1;f--)
{
cout<<"\3";
}
cout<<endl;
}
for(i = 1; i <= n; i++)
{
for( j = n - 1; j >= i; j--)
{
cout << " ";
}
for( k = 1; k <= i + ( i - 1 ); k++)
{
cout << "\3";
}
cout << endl;
}
cout << endl;
getche();
}
Langganan:
Posting Komentar (Atom)
0 comment:
Posting Komentar
Comment Here ^_^.....