#include<stdio.h> #include<stdlib.h> #include<iostream> using namespace std; const int maxn=10010; int prime[maxn]; bool p[maxn]; int pNum; int main() { int n=0; cin>>n; for(int k=1-n;k<=n-1;k++) { int i=n-abs(k); for(int j=1;j<=abs(k);j++) printf(" "); for(int j=1;j<=2*i-1;j++) printf("*"); printf("\n"); } } |
Double click to view unformatted code.