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]
4 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]4 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
OSHA requires that employers pay for most required personal protective equipment (PPE), including: A. Hard hats B. Logging boots
Triss [41]
Im not 100% but Im pretty sure the answer is A. Hard hats

Hope this helps :)

6 0
3 years ago
Your manager asks you to calculate the sale price if the product is marked down 20 percent. You enter the original price in cell
Deffense [45]

Answer:

Option =42*.80

Explanation:

We can define a formula in Microsoft Excel using which is always started with "=" and then followed with the mathematical rule defined on the target columns or rows.

In this question,  we are expected to calculate the marked down price for 20 percent. This means the new sale price will be 80% of the original sale price. Since the original place is in cell A2, we can define a formula using =A2* .80 to get the expected result.

3 0
3 years ago
What are some positive impacts technology has on the environment?​
dsp73

Answer:

<u>technology</u> has enabled us to capture useful heat through devices such as solar panels

Explanation:

<h3 />
7 0
3 years ago
Read 2 more answers
What port is typically reserved and utilized by the Secure Hypertext Transfer Protocol to create a secure connection to a Web se
jek_recluse [69]

Answer:

Port 443

Explanation:

This is the Hypertext Transfer Protocol Secure that combines the HTTP with a cryptographic protocol, which can be used for payment transactions and other secure transmission of data from Web pages. Whenever you connect to a website beginning with "https://" or you see the lock icon, you’re connecting to that web server over port 443.

4 0
3 years ago
How many discussion posts must you complete to meet the Expectations of the replies category
Dennis_Churaev [7]

Answer:

I want to take this time to discuss a few expectations and helpful information about how to participate in the weekly online discussions. You can scroll down the page or use the links here to navigate to each section.  All Discussions can be found by clicking on the Discussions link located on the left-hand side of the course.

Explanation:

Participation in the discussion forums is critical for maximizing student learning in this course, both because your participation is graded and because it's a chance to engage in a dialogue about course material.  In this course, students are required to be a part of an online community of learners who collectively interact, through discussion, to enhance and support the professional performance of each other. Part of the assessment criteria for the course includes evaluating the quality and quantity of your participation in the discussion forum.

The TAS will facilitate student discussions, although they likely will not address every single post. In most cases, they might share a related idea, intervene when the discussion goes off-track, or tie student comments together to help deepen student learning.  Remember, if you have a specific question, pose

3 0
3 years ago
Other questions:
  • HELP NOW PLZZ/ Question: Complete the sentence with the correct response.
    11·1 answer
  • What is the 7 X 7 when referring to PowerPoint presentations?
    12·2 answers
  • Given the scenario, before leaving the office, you ask the CIO to provide which formal document authorizing you to perform certa
    11·1 answer
  • 2. What is data redundancy?
    14·1 answer
  • What is the name of the newer communication protocol that is supported by Window 10's version of TCP/IP?
    11·1 answer
  • Explain why it is not necessary for a program to Explain why it is not necessary for a program to be completely free of defects
    13·1 answer
  • Respond to the following in a paragraph of no less than 125 words. Describe the steps to active listening.
    7·2 answers
  • 1. A bank customer invested $24 in a bank with 5 percent simple interest per year, write a program the construct a table showing
    11·1 answer
  • Which are the 2 main elements that’s make up computer architecture?
    6·2 answers
  • What command will prevent all unencrypted passwords from displaying in plain text in a configuration file?.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!