Y
Y
yura_khval2015-10-26 19:23:01
C++ / C#
yura_khval, 2015-10-26 19:23:01

How to print 5 asterisks in reverse order and so that they are in descending order and on a new line using while?

For example:
*****
****
***
**
*

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg Tsilyurik, 2015-10-26
@Olej

char asterisk[] = "*****", *pa = &asterisk;
while( *pa != 0 ) 
   cout << pa++ << endl;

A
Anonymous11337, 2015-10-26
@Anonymous11337

int marker = 5;
while(marker)
{
  int inner_marker = marker;
  while(inner_marker--) 
    std::cout << "*";	
  std::cout << std::endl;
  --marker;
}

Didn't specifically comment. Try to figure it out yourself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question