problem solve

This is a discussion on problem solve within the C Programming forums, part of the General Programming Boards category; can some one help me the program is input:7 output is 0000000 0111110 0122210 0123210 0122210 0111110 0000000 another is ...

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    1

    problem solve

    can some one help me

    the program is

    input:7
    output is

    0000000
    0111110
    0122210
    0123210
    0122210
    0111110
    0000000

    another
    is
    input:9

    output

    000000000
    011111110
    012222210
    012333210
    012343210
    012333210
    012222210
    011111110
    000000000

    thank you for some can help me

  2. #2
    Registered User
    Join Date
    Mar 2005
    Posts
    38
    Did you try something yourself?

  3. #3
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,399
    Sure.
    Code:
    #include<stdio.h> /*square*/
    main(_,t,_t)int*t;{for(t=&_,
    printf("input: "),scanf("%d"
    ,t),t=(int*)!(_t^_t),_t=_^_;
    _t<_*_;printf("%d",(_t/_<_>>
    (int)t?_t/_:_-_t/_-(int)t)<(
    _t%_<_>>(int)t?_t%_:_-_t%_-(
    int)t)?_t/_<_>>(int)t?_t/_:_
    -_t/_-(int)t:_t%_<_>>(int)t?
    _t%_:_-_t%_-+(int)t),!((_t+(
    int)t)%_)&&printf("\n"),_t++
    );return _t^_t*-+_<<(int)t;}
    It behaves poorly when negative numbers are entered, but these things happen.

    In all seriousness, exactly what kind of help do you need? Do you know and understand an algorithm for printing out that sort of square?
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    Could you try to indent that code? I can't read it. Call me blind.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    #include<stdio.h> /*square*/
        main(_,t,_t)int*t;{for(t=&_,
        printf("input: "),scanf("%d"
        ,t),t=(int*)!(_t^_t),_t=_^_;
        _t<_*_;printf("%d",(_t/_<_>>
        (int)t?_t/_:_-_t/_-(int)t)<(
        _t%_<_>>(int)t?_t%_:_-_t%_-(
        int)t)?_t/_<_>>(int)t?_t/_:_
        -_t/_-(int)t:_t%_<_>>(int)t?
        _t%_:_-_t%_-+(int)t),!((_t+(
        int)t)%_)&&printf("\n"),_t++
        );return _t^_t*-+_<<(int)t;}
    There ya go.

    Quzah.
    Hope is the first step on the road to disappointment.

  6. #6
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146

    Lol
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

  7. #7
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,399
    Quote Originally Posted by quzah
    There ya go.

    Quzah.
    Thanks Quzah. I was a little busy.

    [edit]I submit version 2.0 of square. It fixes that little negative number bug.
    Code:
    #include<stdio.h> /*square*/
    main(_,t,_t)int*t;{for(t=&_,
    printf("input: "),scanf("%d"
    ,t),t=(int*)!(_t^_t),_t=_^_;
    _t<_*_&&+_>!(int)t;printf("\
    %d",(+_t/_<_>>(int)t?_t/_:_-
    _t/_-(int)t)<(_t%_<_>>(int)t
    ?_t%_:_-_t%_-(int)t)?+_t/_<_
    >>(int)t?_t/_:_-_t/_-(int)t:
    _t%_<_>>(int)t?_t%_:_-_t%_-(
    int)t),+!((+_t+(int)t)%+_)&&
    printf("\n"),_t++);return _t
    ^_t*-+_<<(int)t/(_+(int)t);}
    Last edited by pianorain; 04-26-2005 at 12:35 PM.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  8. #8
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    Ha ha. No, seriously.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Solve This Problem Within 3 Hr Urgent Need
    By annum in forum C Programming
    Replies: 12
    Last Post: 10-04-2009, 09:56 AM
  2. Problem I can't seem to solve
    By psykik in forum C Programming
    Replies: 15
    Last Post: 05-19-2005, 12:18 PM
  3. Replies: 2
    Last Post: 04-25-2005, 11:59 AM
  4. Bubble Sort / selection problem
    By Drew in forum C++ Programming
    Replies: 7
    Last Post: 08-26-2003, 03:23 PM
  5. problem cant solve please help.
    By sarah in forum C Programming
    Replies: 6
    Last Post: 09-03-2001, 01:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21