Mencetak bintang C++

#include<iostream>
#include<conio>

int main()
{
 int a,b,c,d;
 cout<<"masukkan jumlah baris= ";cin>>a;
 for(b=1;b<=a;b++)
 {
  for(c=a;c>=b;c--)
  {
   cout<<" ";
  }
  for(d=1;d<=b;d++)
  {
   cout<<"*";
  }
   cout<<endl;
 }
 getch();
}


Share:

0 comments:

https://fikiirawan.blogspot.com/

Blog Archive

Pages

Blog Archive