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 would like to help guide your company in choosing between valuing privacy and increasing the company's bottom line. What is
Ainat [17]

In the above case, the option that will help to guide your company in choosing between valuing privacy is a set of internal principles.

<h3>What are internal control principles?</h3>

The principles of internal control are known to be  needed in the management to set methods in place to make sure that company assets are kept.

Therefore, In the above case, the option that will help to guide your company in choosing between valuing privacy is a set of internal principles.

Learn more about internal principles from

brainly.com/question/27015769

#SPJ1

6 0
2 years ago
You need to design a backup strategy. You need to ensure that all servers are backed up every Friday night and a complete copy o
cestrela7 [59]

Answer: (A) full backup

Explanation: A backup strategy is a term used to describe the various effective approach engaged in creating a backup for data or information.

A FULL BACK UP IS THE VARIOUS APPROACH AND SYSTEMS PUT IN PLACE BY A COMPUTER USER OR AN INFORMATION TECHNOLOGY EXPERT IN ORDER TO CREATE AN ADDITIONAL SAMPLE OR COPY OF AN INFORMATION OR A DATA IN S SINGLE BACKUP.

8 0
3 years ago
HELLLP
mojhsa [17]

Explanation:

The output of this program is 5 7, because the first time bruce is printed, his value is 5, and the second time, his value is 7. The comma at the end of the first print statement suppresses the newline after the output, which is why both outputs appear on the same line.

Here is what multiple assignment looks like in a state diagram:



With multiple assignment it is especially important to distinguish between an assignment operation and a statement of equality. Because Python uses the equal sign (=) for assignment, it is tempting to interpret a statement like a = b as a statement of equality. It is not!

First, equality is symmetric and assignment is not. For example, in mathematics, if a = 7 then 7 = a. But in Python, the statement a = 7 is legal and 7 = a is not.

Furthermore, in mathematics, a statement of equality is always true. If a = b now, then a will always equal b. In Python, an assignment statement can make two variables equal, but they don’t have to stay that way:

a = 5

4 0
2 years ago
Read 2 more answers
Which device do you think is the most important in the development of human civilization
insens350 [35]

Answer: The most important characteristic for the development of a civilization is the presence of advanced cities because they were centers of trade, which established economies and allowed for further development of the civilizations.

Explanation:

Your welcome :)

7 0
3 years ago
Which of the following not a hardware componet​
erma4kov [3.2K]

Answer:

antivirus.......hope this answers your question

3 0
2 years ago
Other questions:
  • The weird suspicious box that k12 sends the parents to put on the router. im getting strange privacy error messages on google an
    8·1 answer
  • Which of the following tasks would a database administrator perform ? A identify computer security photos, B. Make sure protocol
    15·1 answer
  • Where is authorization management app on tablet?
    7·1 answer
  • 22 If you are involved in a violation and you do not have insurance to comply with the __________________, your driver license a
    9·2 answers
  • The cost of large ground based telescopes has remained the same since the 1800's costing the equivalent of about a billion dolla
    9·1 answer
  • Class sizes of various sections of college algebra at your university are an example of which type of data? quiizlet
    13·1 answer
  • If you were looking for a record in a very large database and you knew the ID number, which of the following would be the most d
    6·1 answer
  • List two types of energy sources
    10·2 answers
  • What is the top 3 cloud provider in the world with statics or data including the example and reason(s).
    11·1 answer
  • write code to print out all combinations of pairs of numbers 1 through m and 1 through n, separated by a comma
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!