Program Menampilkan Bintang Dalam Bentik Segitiga

Posted by Budi Arieyanto | Posted in | Posted on 05.10

#include<iostream.h>
#include<conio.h>
void main()
{

for (int i=1;i<=3;i++)
{
      for (int j=1;j<=5;j++)
    {
        if (i==1)
            if (j==3)
                cout<<"*";
            else
                cout <<" ";
      if(i==2)
            if (j==2)
         cout<<"***";
            else
                cout<<" ";
      if (i==3)
          if (j==1)
                cout<<"*****";
        if(j==5)
            cout <<endl;
   }
}
getch();
}

Comments (0)

Posting Komentar