answer.
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
STatiana
1 month ago
5

For the following code, if the input is negative, make numitemsPointer be null. Otherwise, make numitemsPointer point to numitem

s and multiply the value to which numitems Pointer points by 10.
Ex: If the user enters 99, the output should be: Items: 990
Code :
#include
int main(void) {
int* numItemsPointer;
int numItems;
scanf ("%d", &numItems);

/* Your solution goes here */

if (numItems Pointer == NULL) {
printf ("Items is negative\n");
}
else { printf("Items: %d\n", *numItemsPointer);
}
return 0;
}
Computers and Technology
2 answers:
Harlamova29_29 [1K]1 month ago
7 0

Answer:

The solution for the given question can be outlined as follows:

Program:

#include <stdio.h> // include the header file

int main() // declare the main function

{

int* numItemsPointer; // declare a pointer for integer

int numItems; // declare an integer variable

scanf ("%d", &numItems); // receive user input

if(numItems < 0) // check if the input value is negative

{

numItemsPointer = NULL; // set pointer to null

printf ("Items is negative\n"); // output a message

}

else // if the condition is false

{

numItemsPointer = &numItems; // point to the address of numItems

numItems = numItems * 10; // multiply numItems by 10

printf("Items: %d\n", *numItemsPointer); // output the value

}

return 0;

}

Output:

99

Items: 990

Explanation:

The program defines two integer variables, "numItemsPointer" as a pointer and "numItems" as an integer. The user inputs a value which is checked through an if statement to calculate results, detailed as follows:

  • In the if condition, if "numItems" is less than 0, it sets its value to "NULL" and prints an appropriate message.
  • If the condition is false, it transfers the address of "numItems" to the pointer and then multiplies "numItems" by 10 before printing the value held by the pointer.
Rzqust [1K]1 month ago
3 0

Answer:

hello

Explanation:

You might be interested in
Coretta is thinking about which careers she would enjoy. She considers her personal skills and interests. She enjoys reading and
8_murik_8 [964]

Answer:

zoologist

Explanation:

5 0
1 month ago
Read 2 more answers
A four-year-old laptop will not boot and presents error messages on screen. You have verified with the laptop technical support
8_murik_8 [964]
Consider whether the laptop is worth fixing. If it is, proceed with the repair, and if it isn’t, you know the next steps.
7 0
1 month ago
A technique that’s used to route traffic to different destinations, depending on factors like location, congestion, or link heal
amid [951]
A method used to guide traffic to various destinations based on considerations like location, congestion, or link health is termed Anycast. It ranks among the top five techniques for Internet traffic routing, alongside unicast, broadcast, multicast, and geocast.
4 0
15 days ago
Read 2 more answers
In three to five sentences, describe whether or not files should be deleted from your computer. Explain your answer.
Amiraneli [1052]
I can see points from both sides here. First, files that should be deleted would be those we no longer need. The extra space on our computers is valuable. If a file was significant and you’ve handled it, it’s time to remove it since it’s no longer relevant. Now, on the contrary, we shouldn’t delete files because there might come a time when we need them again... For example, you may possess vital documents that you'd definitely want to keep. Or perhaps you’d like to reminisce by looking back at old photos or videos with friends or a significant other.
5 0
26 days ago
Read 2 more answers
Three business partners are forming a company whose name will be of the form "name1, name2 and name3". however, they can't agree
zubka84 [1067]

ANSWER: You must use 3 print line commands here. Thus, the optimal code looks like this:

import java.util.Scanner;

public class business {

public static void main(String args[]){

Scanner stdin = new Scanner(System.in);

String Larry = stdin.nextLine();

String Curly = stdin.nextLine();

String Moe = stdin.nextLine();

System.out.println(Larry + "\t" + Curly + "\t" + Moe);

System.out.println(Larry + "\t" + Moe + "\t" + Curly);

System.out.println(Curly + "\t" + Larry + "\t" + Moe);

System.out.println(Curly + "\t" + Moe + "\t" + Larry);

System.out.println(Moe + "\t" + Larry + "\t" + Curly);

System.out.println(Moe + "\t" + Curly + "\t" + Larry);

}

}

5 0
1 month ago
Other questions:
  • A company that allows you to license software monthly to use online is an example of
    5·2 answers
  • Light travels at 3 × 108 meters per second. A light-year is the distance a light beam travels in one year.Write a PYTHON program
    14·1 answer
  • A method countDigits(int num) of class Digits returns the remainder when the input argument num(num &gt; 0) is divided by the nu
    10·1 answer
  • Grabar microphone audio icon_person click each item to hear a list of vocabulary words from the lesson. then, record yourself sa
    7·2 answers
  • Some early computers protected the operating system by placing it in a memory partition that could not be modified by either the
    5·1 answer
  • 8. In time series, which of the following cannot be predicted? A) large increases in demand B) technological trends C) seasonal
    11·1 answer
  • The budget process which emphasizes the achievement of goals and competition between alternatives is:
    12·1 answer
  • Consider a one-way authentication technique based on asymmetric encryption: A --&gt; B: IDA B --&gt; A: R1 A --&gt; B: E(PRa, R1
    13·1 answer
  • Assume that a function named swapdoubles has been defined and is available for use in this exercise: that function receives two
    8·1 answer
  • A wireless network does not benefit like a wired network does, when it comes to collision reduction. Which device reduces collis
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!