Search
 
SCRIPT & CODE EXAMPLE
 

CPP

pyramid shape in c++

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n ; 	
	for(int i=1 ; i <= n ; i++){
		for(int j=i ; j < n; j++){
			printf(" ");
		}
		for(int j=1 ; j <= i*2-1 ; j++){
			printf("*");
		}
		printf("
");
		
	}
	return 0;
}

/**
   *
  ***
 *****
*******
*/
Comment

the pyramid in c++

#include <iostream>
using namespace std;

int main()
{
    int rows;

    cout << "Enter number of rows: ";
    cin >> rows;
	
  	int i = 1;
    while(i  <= rows)
    {
      	int j = 1
        while(j <= i)
        {
            cout << "* ";
          	j++
        }
        cout << "
";
      	i++;
    }
    return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: C++ add value to exception message 
Cpp :: C++ Fahrenheit to Kelvin 
Cpp :: how to make a sqlite3 object in cpp 
Cpp :: iomanip 
Cpp :: invalid next size (normal) c++ 
Cpp :: c++ loop programs 
Cpp :: prints all the keys and values in a map c++ 
Cpp :: return the index where maximum element in a vector 
Cpp :: extern __shared__ memory 
Cpp :: c++ randomization 
Cpp :: qstring get if empty 
Cpp :: qstring insert character 
Cpp :: recursive power in c++ 
Cpp :: #pragma once in main file what is it for 
Cpp :: qstring to char* 
Cpp :: c++ string to integer without stoi 
Cpp :: format c++ discord 
Cpp :: fork was not declared in this scope 
Cpp :: maximum value in map in c++ 
Cpp :: find length of array c++ 
Cpp :: check if an element is in a map c++ 
Cpp :: c++ looping 
Cpp :: unordered_map header file c++ 
Cpp :: max function in c++ 
Cpp :: c++ call by value vs call by reference 
Cpp :: bubble sort in c+ 
Cpp :: c++ int main() 
Cpp :: print each number of digit c++ 
Cpp :: vector search by element 
Cpp :: clear the input buffer in cpp 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =