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
The ___ of a worksheet defines its appearance
Arte-miy333 [17]
The page setup of a worksheet defines its appearance. In page setup there are also many things like what font we are using, margins, number of cells etc.
Worksheets are used to enter, calculate and analyze data in numbers and text, and a collection of worksheets is known as workbook. we can create worksheets in Microsoft Excel.

<span> </span>

4 0
3 years ago
A family member who hasn’t worked with computers before has decided to change jobs. You’ve been asked to explain some of the bas
Olin [163]

Answer: That due to the specific tasks that needs to be accomplished by each program to make an all encompassing program would be inefficient and full  of bugs

Explanation: try to do something along those lines ex why would MySQL be used to check your essay for grammar  the tasks are on opposite spectrums

8 0
3 years ago
I need help with coding in python!
Harlamova29_29 [7]

Answer:

B

Explanation:

3 0
2 years ago
Can you get shocked from a breaker box?
Mashcka [7]
I dont think it would, but maybe you should Google it just in case.
4 0
3 years ago
Shania has started a new job as an app developer. Her first task was to make an old app designed for Android available on other
quester [9]

Answer:

Option B is correct.

Explanation:

As such an application programmer, Shania recently began a new work. The first assignment was to create an earlier software available on certain devices, developed for Android.  

So, she using cross-platform software to compose application code that might convert the current android application code across various native versions to makes it much simpler and quicker for her job.

Other options are incorrect because they are not related to the following scenario.

4 0
3 years ago
Other questions:
  • Being tired has very similar effects on the body as what
    7·1 answer
  • If an ARQ algorithm is running over a 40-km point-to-point fiber optic link then:
    12·1 answer
  • During an interview, your non-verbal communication (body language, gestures, tone of voice, speed of talking,
    6·1 answer
  • In the game of economics, producers look to technological improvements to increase which of the following?
    7·2 answers
  • Write a program that lets a maker of chips and salsa keep track of sales for five different types of salsa: mild, medium, sweet,
    14·1 answer
  • Why when you are on wifi it keeps kicking you off is your class during online learning​
    15·2 answers
  • Write a program that accepts two numbers R and H, from Command Argument List (feed to the main method). R is the radius of the w
    11·1 answer
  • Does anyone know a working free spotify premium on ios 2021 plz i have had any luck finding anything:(​
    15·2 answers
  • photoshop Curves, photoshop an image and manipulate the curves on a selection of the photo. upload the original photo and The ph
    5·2 answers
  • Write two statements that each use malloc to allocate an int location for each pointer. Sample output for given program:
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!