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
MakcuM [25]
3 years ago
12

12. Write C statement(s) that accomplish the following. a. Declare int variables x and y. Initialize x to 25 and y to 18. b. Dec

lare and initialize an int variable temp to 10 and a char variable ch to 'A'. c. Update the value of an int variable x by adding 5 to it. d. Declare and initialize a double variable payRate to 12.50. e. Copy the value of an int variable firstNum into an int variable tempNum. f. Swap the contents of the int variables x and y. (Declare additional variables, if necessary.) g. Suppose x and y are double variables. Output the contents of x, y, and the expression x 12 / y - 18. h. Declare a char variable grade and set the value of grade to 'A'. i. Declare int variables to store four integers. j. Copy the value of a double variable z to the nearest integer into an int variable x.
Computers and Technology
1 answer:
saul85 [17]3 years ago
3 0

Answer:

a.

int x = 25;

int y = 18;

b.

int temp = 10;

char ch ='a';

c.

x += 5;

d.

double payRate = 12.5;

e.

int tempNum = firstNum;

f.

int tempp = x;

x = y;

y = tempp;

g.

printf("Value of x = %f\n",x);

printf("Value of y = %f\n",y);

printf("Arithmetic = %f\n",(x + 12/y -18));

h.

char grade = 'A';

i.

int a,b,c,d;

a = 5; b = 2; c = 3; d = 6;

j.

int x = round(z);

Explanation:

The answers are straight forward.

However, I'll give a general hint in answering questions like this.

In C, variable declaration is done by:

data-type variable-name;

To declare and initialise the variable, you do;

data-type variable-name = value;

So, for questions that requires that we declare and initialise a variable, we make use of the above syntax..

Take (a) for instance:

int x = 25;

int y = 18;

Same syntax can be applied to (b), (d), (e), (h) & (I)

For question (c);

This can be done in two ways;

x = x + 5;

Or

x+=5;

Both will give the same result.

For question (f):

We start by initialise a temporary variable that stores x.

Then we store the value of x in y.

Then we store the content of the temporary variable to y.

This swaps the values of x and y

For question (g):

When printing a double variable in C, we make use of '\f' as a string format

For question (j):

The round function is used to round up a double variable to integer.

You might be interested in
You wish to share cases created and owned by your community users (Customer Community Plus) with the internal product support te
emmainna [20.7K]

Answer:

The correct answer is option C. Custom Sharing Group

Explanation:

A custom Share group enables users to share documents which are being held by the high-volume community and portal users with the internal and external users. This Share groups relate all over portals or communities and are connected with sharing sets. Sharing rules and regulations are utilized to expand sharing accessibility to users in public groups or roles. They enable greater access for specific users.

8 0
3 years ago
Technician A says that oil for the rod bearings comes from splash off the crankshaft. Technician B says that lubrication to the
worty [1.4K]

Answer: technician B

Explanation:

The oil is picked up from the oil pump though a pick up tube that is mounted on the oil pump. The end of the pick up tube sits in the oil at the bottom of the oil pan. The oil is then forced through holes that are drilled into the block. Those holes which are called (journals) lead to the main bearings,rod bearings,lifters, camshaft, ect..

7 0
3 years ago
Linotype is similar to letterpress since both utilize lead type. The difference is that in a linotype, the type is cast into ful
Maru [420]

Answer:

I think it would be.

A-Metal-cast pouring system

<h2>I hope it helps</h2>

8 0
4 years ago
A troubleshooting strategy that removes components from a system in order to get back to a basic configuration is called module
Semmy [17]

Answer:

B. False.

Explanation:

Troubleshooting strategy is a technique used to discover the cause of defeat in a system. The technician must learn to improvise with these strategies to solve a system problems.

Module replacement is a type of troubleshooting strategy that replaces a component with unknown status with another component with good status to determine the cause of the problem.

Removing a component from a system to get back to its basic configuration helps to eliminate factors that may make a computer problem difficult to solve.

3 0
3 years ago
What would a bar graph best be used for? State why and give 2-3 examples of things you could demonstrate with a bar graph.
GaryK [48]

Answer:

Reasons what bar graph is used for.

Explanation:

Bars are shown to compare and contrast data in a bar graph. For example, a data was collected through survey of average rainfall. It represents many unique categories by having many different groups. Those groups are plotted on the x-axis and on the y-axis, the measurements are plotted, like inches.

Hope this helps, thank you !!

8 0
3 years ago
Other questions:
  • Your friend called and told you that he saw information about the classified XYZ program on the Internet. As a cleared employee
    14·1 answer
  • What is the purpose of a turbine in a power plant?
    14·1 answer
  • in a management information system, the quality of information is determined by its usefulness to users, and its usefulness dete
    8·1 answer
  • Apart from the OOPs concepts learned in this lesson, identify additional concepts and write an essay on their functions. Explain
    9·1 answer
  • Mention 3 components that can be found at the back and front of the system unit​
    6·1 answer
  • Who wants to join my Among us?<br><br><br>Code: EDQKNF <br><br><br>&lt;3333​
    9·2 answers
  • ~ I already know this ~ who was the bits victim in five nights at freddys 4 <br> ___10 points___
    12·2 answers
  • Explain the principles of computer applications ​
    11·1 answer
  • List three features of the third generation of computers
    13·1 answer
  • When the CPU performs the work described in the commands,
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!