Pages

Tuesday, September 16, 2014

Membuat Program Bintang Segitiga dengan C++

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

void main()
 {
    int b,i,j,d,e;
    cout<<"Masukan baris :";
    cin>>b;
    for (i=1;i<=b+1;i++)
      {
        for (j=1;j<=i;j++)
        cout<<"*";
        cout<<"\n";

      }
             for (e=1;e<=b;e++)
               {
                for (d=1;d<=b-e+1;d++)
                cout<<"*";
                cout<<"\n";
               }
     getch();
  }

No comments:

Post a Comment

Pages