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
What must you be careful of when retrieving messages/data from mobile devices in public?
pochemuha

We must be careful of when retrieving messages/data from mobile devices in public because of Bluebugging.    It is a form of attack through the use of Bluetooth.  It is more than just Bluesnarling and Bluejacking.  It goes beyond, allowing the thieves to take control of a device.

7 0
2 years ago
What is inputted into a computer system?
Anna [14]

Answer:

Hey mate.....

Explanation:

This is ur answer.....

<em>Input refers to any information, or data, that is sent to a computer for processing. Input is often sent to the computer from a device such as a keyboard, mouse, or other input device. Putting it simple, input is the act of entering data into a computer.</em>

<em />

Hope it helps!

Mark me brainliest....

FOLLOW ME!!!! :)

4 0
2 years ago
What are some options available in the Spelling and Grammar Checker in word?
denpristay [2]
Some options are add to dictionary, ignore once, ignore all, autocorrect, change, and change all.
6 0
3 years ago
Which term does not refer to a variant of the full-size secure digital (sd) memory card?
dsp73

Micro SD term does not refer to a variant of the full-size secure digital (sd) memory card.

<h3>What is Secure Digital a memory card?</h3>

A Secure Digital (SD) card is a tiny flash memory card developed for high-capacity memory and different portable devices, such as car navigation systems, cellular phones, e-books, PDAs, smartphones, digital cameras, music players, digital video camcorders, and individual computers.

<h3>What is the best device for storing digital photos?</h3>

Hard drives are good for storing photos because they are cheap, they provide fast admission to data, and it's very easy to copy a whole hard drive to another hard drive  especially if you have USB 3.0 or Thunderbolt associations

To learn more about Micro SD, refer

brainly.com/question/24723558

#SPJ4

4 0
2 years ago
A Windows Live ID is used to
Inessa [10]

e-mail a presentation.

3 0
2 years ago
Other questions:
  • 2. Imagine you play a game of fetch with the dog. It takes the dog 60 seconds to run a total of 180 meters. What was the dog's a
    6·1 answer
  • Technology offers a variety of rich opportunities available to teachers and students. According to Inan and Lowther (2010), ther
    6·1 answer
  • The fossil record is usually incomplete due to the destruction of fossils.
    10·1 answer
  • If your vehicle leaves the pavement for any reason, remember to take your foot off the gas pedal, hold the wheel firmly, and____
    8·2 answers
  • I need to know thr full number of pie
    8·1 answer
  • File-sharing utilities and client-to-client communication applications can provide the capability to share files with other user
    14·1 answer
  • The advancement in speed of transportation is attributed to invention of this device
    8·1 answer
  • Please its argent and I will give you BRAINLIEST ANSWER 6. How would you confirm that a colourless liquid given to you is pure w
    10·1 answer
  • Refer to the image on the right. Then, using the drop-down menu, identify the correct printer type. A: inexpensive home printer
    10·1 answer
  • Type of Factor Beginning Frog Count Simulation 1 (Low) Simulation 2 (High)
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!