Please write in C: 1.) Clunker Motors Inc. is recalling all vehicles from model
ID: 3756372 • Letter: P
Question
Please write in C:
1.) Clunker Motors Inc. is recalling all vehicles from model years 1995-1998 and 2004-2006. Given a variable modelYear write a statement that prints the message "RECALL" to standard output if the value of modelYear falls within those two ranges.
2.) Clunker Motors Inc. is recalling all vehicles from model years 2001-2006. Given an int variable modelYear write a statement that prints the message"NO RECALL" to standard output if the value of modelYear DOES NOT fall within that range.
Explanation / Answer
1)
// if the range of year is 1995-1998 and 2004-2006
if( ( modelYear >= 1995 && modelYear <= 1998 ) || ( modelYear >= 2004 && modelYear <= 2006 ) )
{
printf("RECALL");
}
2)
// if the year is out of range 2001 - 2006
if( modelYear < 2001 || modelYear > 2006 )
{
printf("NO RECALL");
}