Monday, 23 November 2015

PROGRAM C++ MEMBUAT BINTANG

#include <iostream.h>
#include <conio.h>
void main()
{
int input,i,j,k;
cout<<"Inputkan Jumlah Bintang    : ";cin>>input;
k=1;
while (k<=input)
   {
   i=input;
   while (i>=k)
      {
       cout<<" ";
       i=i-1;
      }
   j=1;

   while (j<=k)
      {
       cout<<"*";
       j=j+1;
      }
   cout<<" ";
   j=1;
   while (j<=k)
      {
       cout<<"*";
       j=j+1;
      }
   k=k+1;
   cout<<endl;
   }
getch();
}

No comments:

Post a Comment