[C++] Program Membuat Segitiga Siku-siku Kiri Bawah dengan Looping While (borland c++)

Input Program (Source Code)

#include <iostream.h>
#include <conio.h>

main()
{
int i,n,j;
i=1;

cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
cout<<endl;
cout<<"PROGRAM MEMBUAT SEGITIGA SIKU-SIKU KIRI BAWAH";
cout<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
cout<<endl<<endl;

cout<<"Banyak baris: ";cin>>n;
cout<<endl;

while(i<=n)
{
cout<<i<<". ";
j=1;
while(j<=i)
{
cout<<"*";
j++;
}
cout<<endl;
i++;
}

getch();
}


Output Program



Algoritma Program

1. Input banyak baris (n)
2. Gunakan looping while untuk membuat segitiga
3. i untuk looping penomoran, sedangkan j untuk looping *





Komentar