Thread: Gotoxy along with FOR Loop

  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    6

    Gotoxy along with FOR Loop

    I want to know that how can I print numbers from 1 to 10 in a way mentioned below :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10


    I'm stuck on following ..
    Code:
    # include <stdio.h>
    # include <conio.h>
    
    main()
    {
    int a;
    
    clrscr();
    
    for (a=1; a<=10; a++)
    {           gotoxy(a,a);
                printf("%d",a);
                printf("\n");                      }
    
    getch();
    }

  2. #2
    Registered User
    Join Date
    Feb 2012
    Posts
    6
    help me out please..

  3. #3
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    Its true that your code belongs in C page, but dont bother littering other pages with such half-formed queries. Do you think the helpful users on this page are just some kind of saps with nothing better to do than jump to action when this sort of half-effort is posted? its a proper wind-up mate. I offered some advice in your c++ pages post, its probably best moved here.

    And what is with the large letters? Do you think also that people are so stooopid they will say 'duh jeez pard, that must be purdy important seein as they dun made the big purdy letters n 'all'
    Last edited by rogster001; 02-07-2012 at 07:10 AM.
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  4. #4
    Registered User camel-man's Avatar
    Join Date
    Jan 2011
    Location
    Under the moon
    Posts
    693
    gotoxy really necessary here? Must be an assignment.
    if a is odd number print at beginning of line, if it is even print tabbed first?
    or
    If a is odd gotoxy (specific)coordinate where you want, else go to other (specific)coordinates.
    Last edited by camel-man; 02-07-2012 at 09:11 AM.

  5. #5
    Registered User
    Join Date
    Feb 2012
    Posts
    6
    Quote Originally Posted by camel-man View Post
    gotoxy really necessary here? Must be an assignment.
    if a is odd number print at beginning of line, if it is even print tabbed first?
    or
    If a is odd gotoxy (specific)coordinate where you want, else go to other (specific)coordinates.
    yes it's an assignment, I'm new to C so please ignore my stupidity and please could any of you let me know the source code for this program and value of 'a' starts from 1; odd number.

  6. #6
    Registered User
    Join Date
    Feb 2012
    Posts
    6
    Please just send me the source code, by which I could be able to generate numbers in that format mentioned above in main post.
    Any help in this regard would be highly appreciated !!

  7. #7
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    I'm sorry, did you come here thinking we offer code-on-demand services? I can assure you that's not the case here. Perhaps you need to read this: Announcements - General Programming Boards

  8. #8
    Registered User
    Join Date
    Feb 2012
    Posts
    6
    Quote Originally Posted by rags_to_riches View Post
    I'm sorry, did you come here thinking we offer code-on-demand services? I can assure you that's not the case here. Perhaps you need to read this: Announcements - General Programming Boards
    all right ! i've almost reached the program but the only problem which I'm unable to solve is the gotoxy one. I'm not getting the same format which I want, that's why I posted it here so that I could get some help that's it. I'm almost done with my program I guess

  9. #9
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Did you read my reply in your other thread? Do you have problems with that approach? If so, what are the problems?
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. gotoxy
    By cutiemil14 in forum C++ Programming
    Replies: 1
    Last Post: 09-06-2010, 10:07 AM
  2. What is gotoxy??
    By Beachblue in forum C Programming
    Replies: 6
    Last Post: 11-23-2008, 01:24 AM
  3. gotoxy(); help!!
    By clique in forum C Programming
    Replies: 2
    Last Post: 10-07-2008, 04:08 AM
  4. Where is gotoxy()?
    By siavoshkc in forum C++ Programming
    Replies: 5
    Last Post: 02-03-2006, 04:30 PM
  5. need help with gotoxy() !!!
    By Unregistered in forum C Programming
    Replies: 7
    Last Post: 02-16-2002, 06:26 AM