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
_______ allows you to specify how a photo is positioned in the text of your document.
Lisa [10]
<span>The answer your looking for is Wrap text!!</span>
5 0
3 years ago
If person A creates an image with a creative common license. Person B then uses the image on his website. Who own the image and
Rudik [331]
Person A, of course. This person is the original maker of the image therefore that person has the rights to that image, person B does not automatically become the owner just by using it on his website. So the answer is person A.
3 0
2 years ago
Identify the correct sequence of steps to change the font from Verdana to Arial.
Luden [163]
Go to your text and scroll until you find your preferred text
3 0
2 years ago
Which of the following statements about the OSI is FALSE?A. The OSI model encourages modular design in networking.B. Each protoc
Afina-wow [57]

Answer:

The correct answer to the following question will be Option B.

Explanation:

<u>Open System interconnection:</u>

  • A practical and conceptual layout that describes network communication that will be used by the systems that are accessible to interconnection as well as other systems, is called the OSI model. This may also be referred to as the OSI model with seven layers.
  • The OSI model aims to direct developers and creators so that they would modularize with the wireless communication devices and computer programs they build, and to promote a consistent structure that defines the features of a network or telecom system.

Therefore, Option B is the right answer.

8 0
3 years ago
Online activities among businesses
Masja [62]

Some of the online activities among businesses are:

  • SEO consultant. ...
  • Web designer or web developer. ...
  • Blogger. ...
  • Virtual assistant. ...
  • Affiliate marketer, etc

<h3>What are Online Activities?</h3>

This refers to the various activities that are done on the world wide web and is usually used by businesses to increase visibility, and in turn, revenue.

Hence, we can see that the use of online activities by businesses are important because the products and services for sale by businesses are advertised to target audiences through some of the aforementioned activities.

Read more about online activities among businesses here:

brainly.com/question/27172895

#SPJ1

3 0
1 year ago
Other questions:
  • On most computers, the default font size in Word is ____. 8 11 14 16
    6·1 answer
  • How is the JOptionPaneclass used to display a dialog box that performs a yes/noconfirmation?
    10·1 answer
  • create a boolean variable called sucess that will be true if a number is between -10 and 10 inclusively python
    11·1 answer
  • my airpods just do not seem to connect if i try to pair them, reset them, they have this continuous green light, please help me
    12·1 answer
  • How do you change a account on an iPod generation 5
    10·1 answer
  • When troubleshooting firewalls, you should never attempt to repeat the problem because you could do more damage. T/F
    6·1 answer
  • Did anyone else remember that Unus Annus is gone? I started crying when I remembered.... Momento Mori my friends.... Momento Mor
    9·2 answers
  • Given an initialized variable fileName, write a sequence of statements that create a file whose name is given by the variable an
    15·1 answer
  • Which browser feature will delete your history, cache, and cookies the moment you close the special window
    6·1 answer
  • When designers follow accepted standards and protocols, which of the four basic characteristics of network architecture is achie
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!