Thread: i need help to make a c program

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    1

    i need help to make a c program

    Hello, Everbody
    can anyone help me;
    i have to make a program in C
    which gives the output like this;
    using loops;


    output is 1
    22
    333
    4444
    55555
    4444
    333
    22
    1

  2. #2
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    We won't do your homework for you. Post a good try and the errors you're getting, and then maybe we can help you.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  3. #3
    Registered User
    Join Date
    Jun 2006
    Posts
    75

    Lightbulb

    Try this:
    Code:
    #include<stdio.h>
    int home,work;main(){for(home+=49; home<=53; home++){for(work=49;work<=home;work++)putchar(home);
    puts("");}for (home-=2; home>=49; home--){for (work=49; work<=home; work++)putchar(home);puts("");}}

  4. #4
    Registered User verbity's Avatar
    Join Date
    Nov 2006
    Posts
    101
    Dude, come on!!! I suck at this stuff.....but even a person missing their brain should be able to do that.....just read whatever book your supposed to read and you'll figure it out!!!

  5. #5
    Registered User
    Join Date
    Nov 2006
    Posts
    65
    here is a hint..for loops inside for loops with different conditionals.

  6. #6
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    i have to make a program in C
    You or the forum members?
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  7. #7
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    noodles, giving bad advice or bad code is worse than doing nothing.

    After ; or { or } there should always be a newline.
    Use tabs or spaces.
    Haven't you heard of int main() ?
    For without {} braces is a bad idea, especially if you give advice to beginners.
    Always initialize your variables.
    Use as few global variables as you can.
    The program ends and doesn't show anything if you don't put a getchar() or something else there.
    Do not use puts("") for getting a newline! Use putchar('\n').

    You did so many bad things on 3 lines! Isn't that a record?
    Last edited by maxorator; 11-25-2006 at 03:03 AM.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,665
    I dunno, I thought noodles answer was quite good.

    It produces the result (what the OP asked for), but does it in such a way that the OP really can't use the answer for handing in as homework (what the OP wanted).

    Of course, what the OP NEEDS to do if they every want to learn this stuff is actually try and make an attempt at solving the problem rather than reading other peoples answers.

    It's all pretty moot anyway since they haven't even bothered to return since posting, so I guess they've already sponged the answer off someone else and is happy for the moment at least. Poor fool, just wait for the next assignment - you know, the one which gets you to the top of the gentle hill and then you see Everest in the distance and the OMG moment hits.

    > You did so many bad things on 3 lines! Isn't that a record?
    Ever heard of the IOCCC ?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  9. #9
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    Salem, that is the best reply to a homework thread I have seen in this board. Brilliant.
    Double Helix STL

  10. #10
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Ever heard of the IOCCC ?
    It's an art of doing bad things.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  11. #11
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    At least have the sense to tell the difference between a mistake and code that has been purposefully obfuscated, since we don't exist to hand out grades.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with this program I'm trying to make
    By Sshakey6791 in forum C++ Programming
    Replies: 14
    Last Post: 12-01-2008, 04:03 PM
  2. Replies: 9
    Last Post: 06-17-2008, 11:38 AM
  3. want to make this small program...
    By psycho88 in forum C++ Programming
    Replies: 8
    Last Post: 11-30-2005, 02:05 AM
  4. How To Make The Program Installed In Program Files Folder?
    By javacvb in forum Windows Programming
    Replies: 4
    Last Post: 11-05-2003, 05:33 PM
  5. any suggestions on how to make this program smaller?
    By bajan_elf in forum C++ Programming
    Replies: 4
    Last Post: 05-12-2003, 03:24 AM