Selection 1. Write a single statement to accomplish each of the following: a) If
ID: 3809462 • Letter: S
Question
Selection 1. Write a single statement to accomplish each of the following: a) If value is not equal to 15, print "The variable value is not equa to 15 b) Test if the value of the variable num is less than 5. If it is, p "Num is les than 5 2. What are the values of the following expressions? Remember that C does not use Boolean logic (true or false), but rather uses semi-boolean logic (zero or nor zero). You may assume all variables are declared to be of type int. a) i 2; i j i k d) 10; i j i t j i I k Focus on Fundamentals of ProgrammExplanation / Answer
HI, I have answered first two questions, Q1, Q2
Please repost others in separate post.
1)
a)
if(value != 15)
pritf("The variable value is not equal to 15. ")
b)
if(num < 5)
pritf("Num id less than 5 ")
2)
a)
(i+j) = 5 == 6 => 0
Ans: 0
b)
i< j => 3 < 2 = 0
j < k => 2 < 1 = 0
0 == 0 = 1
Ans: 1
c)
i = 3, j = 4, k = 5
i%j = 3%4 = 3
3 + i = 3 + 3 = 6
6 < 5 => 0
Ans = 0
d)
i = 10
j = 5
!i = 0 < 5 => 1
Ans: 1
e)
i = 2
j = 1
!!i+ !j = !(0) + 0 = 1+ 0 = 1
Ans: 1
f)
i = 5
j = 0
k = -5
i&&j = 5 && 0 = 0
0 || k = 0 || -5 = 1
Ans: 1
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.