Please write in C: 1.) Assume that n has been declared and initialized as an int
ID: 3756371 • Letter: P
Question
Please write in C:
1.) Assume that n has been declared and initialized as an int. Write an expression whose value is true if dividing n by 17 yields a remainder of zero.
2.) Assume that n has been declared and initialized as an int. Write an expression whose value equals the remainder of dividing n by 17.
3.) Clunker Motors Inc. is recalling all vehicles from model years 1995-1998 and 2004-2006. An int variable named norecall has been declared. Givenanother int variable modelYear write a statement that assigns 1 to norecall if the value of modelYear does NOT fall within the two recall ranges and assigns 0 otherwise.
Do not use an if statement in this exercise!
Explanation / Answer
1.) Assume that n has been declared and initialized as an int. Write an expression whose value is true if dividing n by 17 yields a remainder of zero.
Answer:---------
if ( n % 17 == 0 )
2.) Assume that n has been declared and initialized as an int. Write an expression whose value equals the remainder of dividing n by 17.
Answer:-----------
if ( n % 17 == 0 )
3.) Clunker Motors Inc. is recalling all vehicles from model years 1995-1998 and 2004-2006. An int variable named norecall has been declared. Given another int variable modelYear write a statement that assigns 1 to norecall if the value of modelYear does NOT fall within the two recall ranges and assigns 0 otherwise.
Answer:----------
norecall = ((modelYear < 1995 || modelYear > 1998) && (modelYear < 2004 || modelYear > 2006));