- Dapatkan link
- X
- Aplikasi Lainnya
Diposting oleh
Stephen Setiawan
pada tanggal
- Dapatkan link
- X
- Aplikasi Lainnya
#include <iostream>
using namespace std;
//Created by Stephen Setiawan
//facebook.com/5371awan
void main()
{ int b, a=4;
while(a>=1)
{
b=1; while(b<a)
{
cout << "*";
b++;
}
cout<<"*"<<endl;
a--;
}
system ("pause");
}
-------------------------------------------------------------------------------
#include <iostream>
using namespace std;
//Created by Stephen Setiawan
//facebook.com/5371awan
void main()
{ int b, a=1;
while (a<=4)
{
b=1; while (b<=a)
{
cout<<"*";
b++;
}
cout<<endl;
a++;
}
system ("pause");
}
Catatan :
Program diatas dibuat pada aplikasi Microsoft Visual C++
-------------------------------------------------------------------------------
#include <iostream>
using namespace std;
//Created by Stephen Setiawan
//facebook.com/5371awan
void main()
{ int a=1, b, c, n=10;
while (a<=n)
{
c=n; while (a<=c)
{
cout<<" ";
c--;
}
b=1; while (b<=a)
{
cout<<"*";
b++;
}
cout<<endl;
a++;
}
cout<<"\nCreated by Stephen Setiawan"<<endl;
cout<<"facebook.com/5371awan"<<endl;
system ("pause");
}
Catatan :
Program diatas dibuat pada aplikasi Microsoft Visual C++
Jika ingin mengganti banyaknya bintang, ganti nilai n=10.
-------------------------------------------------------------------------------
#include <iostream>
using namespace std;
//Created by Stephen Setiawan
//facebook.com/5371awan
void main()
{ int a=1, b, c, n=10;
while (a<=n)
{
c=n; while (a<=c)
{
cout<<" ";
c--;
}
b=1; while (b<=a)
{
cout<<" *";
b++;
}
cout<<endl;
a++;
}
cout<<"\nCreated by Stephen Setiawan"<<endl;
cout<<"facebook.com/5371awan"<<endl;
system ("pause");
}
Catatan :
Program diatas dibuat pada aplikasi Microsoft Visual C++
Jika ingin mengganti banyaknya bintang, ganti nilai n=10.
-------------------------------------------------------------------------------
#include <iostream>
using namespace std;
//Created by Stephen Setiawan
//facebook.com/5371awan
void main(){
int x;
int y = 0;
cout<<"Segitiga siku siku kanan"<<endl;
cout<<"-----------------------------------"<<endl;
cout<<"masukkan angka = ";
cin>>x;
while(y<=x){
int z = 0;
while(z<y){
cout<<" ";
z++;
}
while (z<x){
cout<<"*";
z++;
}
cout<<endl;
y++;
}
cout<<"\nCreated by Stephen Setiawan"<<endl;
cout<<"facebook.com/5371awan"<<endl;
system ("pause");
}
Catatan :
Program diatas dibuat pada aplikasi Microsoft Visual C++
-------------------------------------------------------------------------------
#include <iostream>
using namespace std;
//Created by Stephen Setiawan
//facebook.com/5371awan
void main()
{ int b, a;
cout<<"Segitiga Siku Bawah\n";
cout<<"Masukkan jumlah bintang : ";cin>>a;
while(a>=1)
{
b=1; while(b<a)
{
cout<<"* ";
b++;
}
cout<<"* "<<endl;
a--;
}
cout<<"\nCreated by Stephen Setiawan"<<endl;
cout<<"facebook.com/5371awan"<<endl;
system ("pause");
}
Catatan :
Program diatas dibuat pada aplikasi Microsoft Visual C++
- Dapatkan link
- X
- Aplikasi Lainnya
Komentar
Posting Komentar