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
What are keywords? hep please give a good awncer
Anika [276]

Answer:

Keywords are words or phrases that describe content. They can be used as metadata to describe images, text documents, database records, and Web pages. ... Keywords are used on the Web in two different ways: 1) as search terms for search engines, and 2) words that identify the content of the website.

4 0
3 years ago
Read 2 more answers
................njkkjjiooiuuuu
Damm [24]

Answer:

Cool

Explanation:

4 0
3 years ago
10. In about 100 words Describe two or three social networking apps that could use a smartphone GPS capability be sure to make c
AlekseyPX

Answer:

Check the explanation

Explanation:

Almost all smartphone devices have global positioning satellite (GPS) service capabilities in them, which mean that apps will be able to combine the phone user's location with the available retail outlets and services to build better mobile business opportunities. For instance, some applications can navigate the user to a particular business locations (such as movie theaters, restaurants, or a nearby auto repair facilities) based on the user's present location.

App like twitter can use the GPS capability to tailor yhier user feeds and timelines with digital contents that are intresting to users in that location.

amazon can advertise based on the need of consumers in a particular location.

Google also tailor thier adword and adsense advert based on the location of the user.

6 0
3 years ago
Over the last ten years, what has caused the audience ratio of three major networks, CBS, NBC, and ABC from 90 percent to 60 per
Goryan [66]
D is your answer good luck
5 0
4 years ago
In project management, which step involves the project manager identifying
nasty-shy [4]

Answer: The only help is your lord and savior Jesus Christ Amen YAR

Explanation: The Bible or Church

8 0
2 years ago
Other questions:
  • A type of address translation in which a gateway has a pool of public ip addresses that it is free to assign to a local host whe
    8·1 answer
  • 1.<br> Which of the following is NOT caused by alcohol?
    15·2 answers
  • When writing a personal narrative, what point of view would be best to use? (1 point) first person second person third person th
    10·2 answers
  • Gunther is filling in his own input mask. He wants to format the Social Security numbers of his clients. The field must contain
    5·1 answer
  • Wireless attacks avoid the access points to limit detection. <br> a. True <br> b. False
    9·1 answer
  • Write a program that lets the user enter a nonnegative integer then uses a loop to calculate the factorial of that number. Displ
    11·1 answer
  • Write the definition of a class WeatherForecast that provides the following behavior (methods): A method called set_skies that h
    13·1 answer
  • Why do chloroplasts appear only in plant cells and lysosomes appear only in animal cells?
    13·1 answer
  • What are some ways tables can be inserted into a document check all reply
    9·2 answers
  • Why do relational databases use primary keys and foreign keys?.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!