Horje
Pyramid pattren program in C++ Code Example
Pyramid pattren program in C++
#include <iostream>
using namespace std;

int main() {
  int size = 5;
  for (int i = 0; i < size; i++) {
    // print spaces
    for (int j = 0; j < size - i - 1; j++) {
      cout << " ";
    }
    // print stars
    for (int k = 0; k < 2 * i + 1; k++) {
      cout << "*";
    }
    cout << "\n";
  }
  return 0;
}

/* Output
    *
   ***
  *****
 *******
*********

*/




Cpp

Related
convert preorder to postorder calculator Code Example convert preorder to postorder calculator Code Example
Quicksort taking random pivot Code Example Quicksort taking random pivot Code Example
partition in STL using vector Code Example partition in STL using vector Code Example
object as a function argument and returning object Code Example object as a function argument and returning object Code Example
fast input and output c++ Code Example fast input and output c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9