#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2014
    Posts
    2
    Rep Power
    0

    Looping for beginners


    Hey everyone,

    I'm as new as they get and I am currently learning C. I was wondering how I could loop this to ask my question over and over again until I have the right input in C. It would be awesome if someone could help. Please do not be thrown off because I am a noob. thank you in advance.

    Code:
    #include <stdio.h>
    
    int main(void)
    {
      printf("number: ");
      
      if(number >= 0 && number <=10)
       condition;
      else
        ????
    }
    How do I get the program to go back and keep asking until someone has entered those parameters? Thank you in advance.
  2. #2
  3. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,614
    Rep Power
    1945
    How to use loop

    To get user input, you will have to lookup the function scanf.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2014
    Posts
    2
    Rep Power
    0
    Hey,

    Thanks for that! exactly what i needed.

IMN logo majestic logo threadwatch logo seochat tools logo