Wednesday, February 10, 2010

C Programming - Logical Value of TRUE and FALSE?

Let i be an integer whose value is 7 and let f be a floating point variable whose value is 5.5. Fill in the following for each expression, use the original values of i and f. Please also rationalize your answers.





f%26gt;5 --- TRUE/FALSE? Logical Value = ??





!(f%26gt;5) --- TRUE/FALSE? Logical Value = ??





i%26lt;=3 --- TRUE/FALSE? Logical Value = ??





!(i%26lt;=3) --- TRUE/FALSE? Logical Value = ??





i%26gt;(f+1) --- TRUE/FALSE? Logical Value = ??C Programming - Logical Value of TRUE and FALSE?
common comparison


! means not


%26gt; greater than


%26lt;less than


%26lt;= less than or equal


f=5.5


f%26gt;5 --%26gt; 5.5%26gt;5 ---%26gt;true


!(f%26gt;5) --%26gt;not (5.5%26gt;5)---%26gt; not true --%26gt;false


i%26lt;=3 ---%26gt;7%26lt;=3 --%26gt;false


!(i%26lt;=3)--%26gt;not (7%26lt;=3) ---%26gt;not false --%26gt;true


i%26gt;(f+1) --%26gt; 7%26gt;(5.5+1)--%26gt;7%26gt;6.5---%26gt; true

No comments:

Post a Comment