Skip to main content

Star Pattern

 /* @ToDo 


   Star Pattern 
                *   
            *   *   *   
        *   *   *   *   *   
    *   *   *   *   *   *   *   
*   *   *   *   *   *   *   *   *   
*   *   *   *   *   *   *   *   *   
    *   *   *   *   *   *   *   
        *   *   *   *   *   
            *   *   *   
                *   

   
   
*/


#include <iostream>
using namespace std;

int main(){
     #ifndef ONLINE_JUDGE
        freopen("../asset/input.txt","r",stdin);
        freopen("../asset/output.txt","w",stdout);
    #endif
    // Code here!!

    int ncin>>n;
    for(int i=1;i<=n;i++){
        for(int j=0;j<n-i;j++)
            cout<<"\t";
        for(int j=1;j<2*i;j++)
            cout<<"*\t";
        cout<<endl;
    }
    for(int i=n;i>0;i--){
        for(int j=0;j<n-i;j++)
            cout<<"\t";
        for(int j=1;j<2*i;j++)
            cout<<"*\t";
        cout<<endl;
    }

    return 0;
}

Comments

Must Read:

Accenture Mock Quiz | Part 5

Question  40 Correct Marked out of 1.00 Flag question Question text Which of the following attribute is used by a HTML tag to apply inline style? Choose most appropriate option. Select one: a.  style   b.  id c.  styleclass d.  class Feedback The correct answer is: style Question  41 Correct Marked out of 1.00 Flag question Question text Identify the CORRECT statements with respect to CSS. a) CSS is used for giving style for HTML content b) External style sheet can be used only for one HTML page in a website Choose most appropriate option. Select one: a.  only a   b.  only b c.  neither a nor b d.  both a and b Feedback The correct answer is: only a Question  42 Correct Marked out of 1.00 Flag question Question text Which of the following statements is TRUE for CSS? A. An external style sheet is ideal when the style is applied to many pages B. An inline style created for a html tag can be reused for other tags in same page...

Subscribe to Get's Answer by Email