Shanu
Shanu

Reputation: 645

simple method to print star pyramid with minimal code in dart?

What is the simplest method to print star pyramid with minimal code? It shouldn't use more than one looping statement. I've produced pyramids with nested loop but I need more leaner code.

Upvotes: 0

Views: 1114

Answers (2)

Vijay
Vijay

Reputation: 7

var b = 8;
int a =1;
for(int i=b;i>0;i--){
print(' '*i + '* '*a);
a=a+1;
}

Upvotes: -2

aswinbbc
aswinbbc

Reputation: 161

  const int row = 5;
  for(int i = 0;i<row;i++){
    stdout.writeln(" "*(row-i)+"* "*i);
  }

Upvotes: 1

Related Questions