fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int n ; cin>>n;
  7. for(int i =1;i<=n;i++){
  8. for(int j =1;j<=2*n-1;j++){
  9. if(i==n||i+j==n+1||j-i==n-1){
  10. cout<<"*";
  11. }
  12. else{
  13. cout<<" ";
  14. }
  15. }
  16. cout<<endl;
  17.  
  18. }
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5324KB
stdin
5
stdout
    *    
   * *   
  *   *  
 *     * 
*********