1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Please help me know the code for this pattern please :(

Discussion in 'Meet and Greet' started by Miigz, Sep 22, 2013.

  1. Miigz

    Miigz New Member

    Joined:
    Sep 21, 2013
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Write a program that will display a pattern depending on n. Assume n as a one digit odd number.

    Example: if n=9, display
    *000*000*
    0*00*00*0
    00*0*0*00
    000***000

    How will i start doing this type of problem?
    I am new here, and Im finding for about 1 week for the codes/answer for this. Still cant, its my project needed to submit on Monday. Its Saturday here in my place.

    Thanks guys

    C Programming. C Language
     
  2. imported_Isa

    imported_Isa New Member

    Joined:
    Sep 1, 2010
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Bachelor
    Location:
    shahi(search in fb)
    you should have out put raw by rew
    so
    use one for

    Code:
     for ( var i = 0 ; i <  ((n / 2)+1) ; i++) 
    then for the column , use something like this :

    Code:
     for ( var j = 0 ; j < n ; j ++) 
    now the conditions :

    Code:
    if ( j === i &&  j === n-i && j === n/2) write "*";
    else write "0";
    
    just this. and I think it will work. but it isn't optimized. it will your own.
     

Share This Page