1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: While loop

  1. Aug 20, 2016 #1
    1. The problem statement, all variables and given/known data
    for teh circled part , why there's again =='y' ? i didnt see the variable 'y' anywhere other than the circled part ...What does it mean ?
    2. Relevant equations

    3. The attempt at a solution
    Is the code wrong ?

    Attached Files:

    • 1.PNG
      File size:
      14.8 KB
  2. jcsd
  3. Aug 20, 2016 #2


    User Avatar

    Staff: Mentor

    Characters in quotes are character constants. The statement in question is checking whether the user has input a 'Y' or a 'y' (so that both upper and lower case are checked).
  4. Aug 21, 2016 #3


    Staff: Mentor

    @chetzread, before you learned about loops and other control structures, there was probably some mention about the various types of constants that can be used in C. At least most of the books I've seen present such material in that order.

    Character constants, such as 'y' or 'B' or '\t'
    String constants, such as "cat"
    integer constants, such as 23, 023, and 0x23 (all with different values)
    floating point constants, such as 2.7 (a double) and 3.09F (a float)
    This is not meant to be an exhaustive list.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted