Kat H.

asked • 04/25/21

C Programming Language. Please write the two programs in C. 

C Programming Language. Please write the two programs in C. 

Digits

Write this program in a file named digits.c.

As input, you will define a quad word integer variable named input in the initialized data section. Choose 0 <= input < 1000 so that the value is representable in three decimal digits.

As output, you will have three quad word integer variables named onestens, and hundreds in the uninitialized data section (bss). Your program should calculate the decimal representation of input, putting the ones place in ones and so on. The div instruction will be your primary mathematical tool.

Height

 Write this program in a file named height.c.

The height in an object will reach if it is thrown straight up depends on its initial velocity and the force of gravity, g. The value of g varies depending on what planet/body you are on: on Earth, g is 9.8 m/s^2; on Mars, 3.7 m/s^2; on the Moon, it is 1.6m/s^2.

As input, you will define a double-precision floating-point variable named velocity in the initialized data section. Similarly define the constant g (based on Earth).

As output, you will define a double-precision floating-point variable named height. Calculate height from velocity and g using this formula:

height = (1/2) * (((velocity)^2)/g)

This will use the XMM registers for floating-point calculations.




1 Expert Answer

By:

Patrick B. answered • 04/26/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.