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]
4 years ago
12

C programming question:

Computers and Technology
1 answer:
denpristay [2]4 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
Select the correct answer.
Luba_88 [7]

Answer:

C. the technical team and external reviewer

7 0
3 years ago
Read 2 more answers
anyone got a class named computer literacy? or sum similar to using Microsoft programs? i need a lotttt of help, im 3 units behi
seropon [69]

Answer:

I use google docs

Explanation:

I am in 6th grade but i am in expert in computers.

6 0
4 years ago
Read 2 more answers
Which of the following is an acronym? A.RAM B.Every Good Boy Does Fine. C.association D.mnemonic device
neonofarm [45]

RAM is an acronym in the given following.

A.RAM

<u>Explanation:</u>

From the given options,  RAM stands for Random Access Memory. RAM comes under primary memory and is a volatile memory, which means the contents of a RAM are lost when the power is turned off.

The man function of RAM is to hold the data when it is being processed. Whenever the user tries to access a program or data, the control unit looks for the program first in the cache memory and then in the RAM for faster access and execution.

If the program is nowhere to be found in the RAM then it is searched in the secondary memory.

7 0
3 years ago
What does it mean when it says this person is unavailable on messenger.
arsen [322]

Answer:

The user has a deactivated account 

Explanation:

or the user does not have the account anymore good luck and I hope you do well <3

4 0
2 years ago
Which of the following does not reflect the second step of effective communication?
Ilya [14]

Answer:

c

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • What would be the desired output of a home security system?
    6·1 answer
  •  When using cost-benefit analysis to determine the benefits of a community project, economists measure the value in terms of (A.
    14·1 answer
  • Joshua is creating his résumé, in which section will he add projects and trainings he was involved in?
    10·1 answer
  • Kendall receives an email stating that a leading computer company is giving away free computers, asking her to forward the email
    15·1 answer
  • Given a string, return a version without the first and last char, so "Hello" yields "ell". The string length will be at least 2.
    13·1 answer
  • Convert 4.5 strides to girth
    10·1 answer
  • Write a program that implements a class called Dog that contains instance data that represent the dog's name and age. • define t
    10·1 answer
  • susan wrote the recursive formula for the sequence represented by the exploit formula An=3+2n. put an C net to any correct state
    13·1 answer
  • Define print_shape() to print the below shape. Example output:
    8·1 answer
  • Suppose a computer's login mechanism first asks for a user name, and then for the password, regardless of whether or not the log
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!