Thread: Noobie Little Help Please

  1. #1
    Registered User
    Join Date
    Sep 2007
    Posts
    29

    Noobie Little Help Please

    Hi guys I got this program I am working on and it's not yet functioning as I would like it to. Currently the program counts down form 16 to 5, I would like a User to be able to enter a number between 16 and 5 and and have it count down from the User input number. Any help would be great thanks.

    Code:
     #include <stdio.h>
    #define MAX 17
    int main(void)
      {
        int count = MAX + 1;
        while (--count > 5)    {
    
        printf("%d ", count - 1);
        }
        fflush(stdin);
        printf("\n\nPress Enter to continue.\n");
        getchar();
    
        return 0;
    }

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    There are some things for you to look at in the FAQ, particularly How do I get a number from the user (C) and Why fflush(stdin) is wrong.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User
    Join Date
    Sep 2007
    Posts
    29
    I will check out the link thanks dave

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. putting text onto the next line...lol...noobie questions
    By JOlszewski in forum C Programming
    Replies: 2
    Last Post: 01-24-2006, 04:02 PM
  2. noobie maze program
    By stormfront in forum C Programming
    Replies: 9
    Last Post: 11-30-2005, 10:23 AM
  3. Noobie Programmer --> Am i in the right place ?
    By Seeker in forum Game Programming
    Replies: 6
    Last Post: 09-07-2005, 03:49 AM
  4. C++ program jumps for noobie
    By bandito9111 in forum C++ Programming
    Replies: 3
    Last Post: 03-01-2003, 01:48 AM
  5. another noobie question
    By noobie in forum C++ Programming
    Replies: 21
    Last Post: 01-21-2003, 02:04 PM