View Code of Problem 53

#include<stdio.h>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
int main(){
	int n;
	scanf("%d", &n);
	for(int i = -(n-1); i < n; i++){
    	for(int k = 0;k < abs(i); k++)
			printf(" ");
    	int j = 2 * (n - abs(i)) - 1;
    	for(int k = 0;k < j;k++){
   			printf("*");
   		}
  		printf("\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 53