Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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;
}

/**
   *
  ***
 *****
*******
*/
Source by codejudge.blogspot.com #
 
PREVIOUS NEXT
Tagged: #pyramid #shape
ADD COMMENT
Topic
Name
3+1 =