1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
IrinaVladis [17]
3 years ago
12

C programming question:

Computers and Technology
1 answer:
denpristay [2]3 years ago
6 0

Answer:

You should do this:

if (0==strcmp(modelName,"Extravagant") && modelYear >= 1999 && modelYear <= 2002)

printf("%s\n","RECALL");

Explanation:

Lets consider this program and analyze the output.

int main()

{

int modelYear;

char modelName[30];

printf("enter the year");

scanf("%d",&modelYear);

printf("enter the modelname");

scanf("%s",modelName);

if (0==strcmp(modelName,"Extravagant") && modelYear >= 1999 && modelYear <= 2002)

printf("%s\n","RECALL");    }

if (0==strcmp(modelName,"Extravagant") && modelYear >= 1999 && modelYear <= 2002)

This statement has a function strcmp  which is used to compare two strings.

If the user enters Extravagant as model name then this input will be compared by the string stored in modelName i.e. Extravagant, character by character. If the string entered by the user matches the string stored in modelName this means this part of the if condition evaluates to true. 0==strcmp means that both the strings should be equal.

The next part of the if statement checks if the model year entered is greater than or equal to 1999 AND less than or equal to 2002. This means that the model year should be between 1999 and 2002 (inclusive).

&& is the logical operator between both the parts of if statement which means that both should evaluate to true in order to display RECALL.

This is correct way to use because the if (modelName == "Extravagant" && modelYear >= 1999 && modelYear <= 2002)  printf("%s\n","RECALL"); statement will not display RECALL. After entering the model name and model year it will move to the next line and exit.

So in if (0==strcmp(modelName,"Extravagant") && modelYear >= 1999 && modelYear <= 2002)

printf("%s\n","RECALL"); statement when the if condition evaluates to true, then RECALL is displayed in the output.

You might be interested in
A __________ is the blueprint for __________ having similar attributes and behaviors. signature, objects class, parameters heade
MrRa [10]

Answer: E. class, objects

Explanation:

<em>A </em><em><u>class</u></em><em> is the blueprint for </em><em><u>objects</u></em><em> having similar attributes.</em>

As much as classifying something means to define it based on the characteristics that is has that are similar to other things in that class, so also is a class here.

A class is the blueprint or rather template for making objects that have similar attributes which means that the class therefore gives the object its various attributes and its behavior.

4 0
2 years ago
The variables xp and yp have both been declared as pointers to integers , and have been assigned values (i.e., they are each poi
Amanda [17]

Answer:

Following code are:

int *temp;   //declaration of variable

// perform swapping

temp = xp;    

xp = yp;

yp = temp;

Explanation:

we declare an integer data type pointer variable "*temp"  then perform swapping between them.

The variables "xp" and "yp" are already declared and these variables are performing swapping among three.

6 0
3 years ago
Question: define oprators​
Svetlanka [38]

Answer:

Explanation:

Operator can be defined as

a character or characters which gives determination of actions that are needed to be performed/ considered. Operators are symbols that gives the compiler information to perform specific mathematical/logical manipulations.They are special type of functions, which are capable of taking one or more arguments, then produces a new value. Different types of operator are;

✓arithmetic operators(addition "+" substraction "-"

✓relational operators( greater than ">"

lesser than"<"

✓Logical operators.( Connective words/symbols such as AND, NOT, OR)

Arithmetic Operators: These include "+" (addition), "-" (subtraction), "*" (multiplication), "/" (division), "\" (integer

5 0
2 years ago
Do warnings ever expire?
DIA [1.3K]
What’s a warning? how do i get one haha
7 0
3 years ago
Read 2 more answers
How many different messages can I convey if I use 2 light bulbs and each one stays either on or off?
Reptile [31]
3 I just did this ykkk
5 0
3 years ago
Read 2 more answers
Other questions:
  • Why do clocks tick-toc?
    5·2 answers
  • After a new technology is purchased,what are some additional costs that must be incorporated into an upgrade budget?
    6·1 answer
  • In how many ways can the letters of the word APPROXIMATION be arranged?
    12·1 answer
  • Which of the following commands would you use to start the program Main with four strings? a. java Main arg0 arg1 arg2 arg3 b. j
    11·1 answer
  • To remove text from a specific location and keep it to use again, you should select ___
    6·1 answer
  • In Load/Store Architecture, memory is only referenced by load and store instructions.
    15·1 answer
  • Define get_date() function.
    6·1 answer
  • Describe a situation in which you have experienced harm as a consequence of a failure of computer security. Was the failure mali
    6·1 answer
  • Design a flowchart for an algorithm which adds prim numbers starting from 1 up to 50. Change
    9·1 answer
  • What are the methods of gilding<br><br>nonsense will be immediately reported. ​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!