Reputation: 23
How do i get this snippet of code to break the while loop with both "a" and "A"? I can't get the OR function right. Thanks in advance for the help.
while((product = getchar()) !='a')
Upvotes: 1
Views: 175
Reputation: 927
If you want to break the loop when product
is a
or A
, you need to check if product
is not a
and not A
in your loop condition:
while((product = getchar()) !='a' && product != 'A')
Upvotes: 1