Thread: Loop question for C

  1. #1
    Registered User
    Join Date
    Jan 2017
    Posts
    3

    Loop question for C

    How to make a loop from 1-15 using only odd numbers within that range?

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    What have you tried?
    What exactly is your problem?
    Do you know what is odd number?
    Do you know ow to get next odd number?
    Do you know how to write a loop?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    From your previous thread:

    Code:
    for(counter = 1; counter <= 15; counter++)
    If you only want odd numbers, you should try changing counter++ (which increments counter by one) to something different.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 09-22-2016, 09:08 AM
  2. loop question-new at C
    By Sumz4 in forum C Programming
    Replies: 3
    Last Post: 03-06-2009, 04:20 AM
  3. for loop question
    By cdalten in forum C Programming
    Replies: 4
    Last Post: 03-20-2006, 09:42 AM
  4. For Loop Question
    By Cloud@CNET in forum C Programming
    Replies: 3
    Last Post: 03-24-2003, 08:33 AM
  5. loop question
    By nuthead in forum C Programming
    Replies: 2
    Last Post: 09-29-2002, 10:19 AM

Tags for this Thread