fork download
  1. //Jacklyn Isordia CSC5 Chapter 2, P. 83, #15
  2. //
  3. /**************************************************************
  4.  *
  5.  * Display Triangle Pattern
  6.  * ____________________________________________________________
  7.  * This program displays a triangle pattern made of asterisks (*)
  8.  * on the screen.
  9.  *
  10.  * Computation is based on the pattern displayed using cout
  11.  * statement and spaces to format the triangle shape.
  12.  * ____________________________________________________________
  13.  * INPUT
  14.  * None
  15.  *
  16.  * OUTPUT
  17.  * Triangle pattern displayed on the screen
  18.  *
  19.  **************************************************************/
  20. #include <iostream>
  21. using namespace std;
  22.  
  23. int main ()
  24. {
  25. // Output Triangle Pattern
  26. cout << " *" << endl;
  27. cout << " ***" << endl;
  28. cout << " *****" << endl;
  29. cout << "*******" << endl;
  30. return 0;
  31. }
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
   *
  ***
 *****
*******