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
jeka94
3 years ago
7

Create union floatingPoint with members float f, double d and long double x. Write a program that inputs values of type float, d

ouble and long double and stores the values in union variables of type union floatingPoint. Each union variable should be printed as a float, a double and a long double. Do the values always print correcly? Note The long double result will vary depending on the system (Windows, Linux, MAC) you use. So do not be concern if you are not getting the correct answer. Input must be same for all cases for comparison Enter data for type float:234.567 Breakdown of the element in the union float 234.567001 double 0.00000O long double 0.G0OO00 Breaklo n 1n heX float e000000O double 436a9127 long double 22fde0 Enter data for type double :234.567 Breakdown of the element in the union float -788598326743269380.00OGOO double 234.567000 long double 0.G00000 Breakolon 1n heX float 0 double dd2f1aa0 long double 22fde0 Enter data for type long double:
Computers and Technology
1 answer:
Kitty [74]3 years ago
5 0

Answer:

Here the code is given as follows,

#include <stdio.h>

#include <stdlib.h>

union floatingPoint {

float floatNum;

double doubleNum;

long double longDoubleNum;

};

int main() {

union floatingPoint f;

printf("Enter data for type float: ");

scanf("%f", &f.floatNum);

printf("\nfloat %f ", f.floatNum);

printf("\ndouble %f ", f.doubleNum);

printf("\nlong double %Lf ", f.longDoubleNum);

printf("\n\nBreakdown in Hex");

printf("\nfloat in hex %x ", f.floatNum);

printf("\ndouble in hex %x ", f.doubleNum);

printf("\nlong double in hex %Lx ", f.longDoubleNum);

printf("\n\nEnter data for type double: ");

scanf("%lf", &f.doubleNum);

printf("float %f ", f.floatNum);

printf("\ndouble %f ", f.doubleNum);

printf("\nlong double %Lf ", f.longDoubleNum);

printf("\n\nBreakdown in Hex");

printf("\nfloat in hex %x ", f.floatNum);

printf("\ndouble in hex %x ", f.doubleNum);

printf("\nlong double in hex %Lx ", f.longDoubleNum);

printf("\n\nEnter data for type long double: ");

scanf("%Lf", &f.longDoubleNum);

printf("float %f ", f.floatNum);

printf("\ndouble %f ", f.doubleNum);

printf("\nlong double %Lf ", f.longDoubleNum);

printf("\n\nBreakdown in Hex");

printf("\nfloat in hex %x ", f.floatNum);

printf("\ndouble in hex %x ", f.doubleNum);

printf("\nlong double in hex %Lx ", f.longDoubleNum);

return 0;

}

You might be interested in
Input a number and find the square root only if the number entered is greater than or equal to zero.
Svetradugi [14.3K]

number = float(input("Enter a number: "))

if number >= 0:

   print(number**0.5)

I hope this helps!

5 0
3 years ago
Short Essay on the history of Computer​
Ann [662]
Go on a essay website the right a essay about a topic !
5 0
3 years ago
Read 2 more answers
julie was just hired to conduct a security assessment of dion training’s security policies. during her assessment, she noticed t
Tasya [4]

An Increase in individual accountability is the improvement that this recommended action will provide for the company.

<h3>What is the aim of the training’s security policies improvement?</h3>

In order to adequately provide accountability, the use of shared or group accounts should be disabled and this allows you to log and track individual user actions based on their individual user accounts.

Also, it will enables the organization to hold users accountable for their actions, too.

Therefore, the Increase in individual accountability is the improvement that this recommended action will provide for the company.

Read more about security policies

brainly.com/question/28165644

#SPJ4

3 0
1 year ago
How does consumption of alcohol affect your driving skills? Name three ways that alcohol can affect your driving.
Natali [406]

Drinking and driving is not recommended. You need your, hands, feet, brain, and eyes to maneuver around. Drivers must be alert and able to make judgments quickly. Drinking and driving can affect the driver in the following ways.

Judgment

The brain is the first part of the body that is affected by alcohol. Your ability to think clearly and plan ahead levels down to as low as .02%

Concentration

Alcohol can leave you concentrating on only one action. You need to stay focused on several things at once. Alcohol will interrupt your focus and might result to an accident. Many accidents are as a result of a short attention span or a distracted driver.

Vision

Alcohol, especially when taken in excess, will impair your eye movement. Not only will it slow down your eye muscle function but  will also reduce peripheral vision.

8 0
4 years ago
Read 2 more answers
Peter’s Father wants to buy a new computer for his office use on word processing tasks. He wants to bring his computer to and fr
8_murik_8 [283]
A good option for Peter's father's computer needs would be a laptop or a notebook.  It is handy so he can bring it to and from the office.  It is also has the specifications needed for his word processing tasks as long as he installs a work processing software.
3 0
3 years ago
Read 2 more answers
Other questions:
  • Describe the "Mister Splashy Pants" campaign. How did it start? What happened?
    7·2 answers
  • Keyshia is preparing a report about the different tools that are used in a science laboratory. She wants to edit a picture of gl
    11·2 answers
  • The ____ is the configuration of a system documented at the beginning of the project and consists of all necessary system requir
    8·1 answer
  • Convert 311 from decimal to hexadecimal. Show your work.
    9·1 answer
  • Jeremy is working with a team that is creating an application using attributes and associated methods. What type of programming
    8·1 answer
  • The one who will defeat me in this typing race I will mark him/her brainliest
    10·1 answer
  • 2. The internet offers a great source of information; however, how are
    9·1 answer
  • Lesson 12: while loops with the farmer. Number 9.
    10·2 answers
  • Which option is designed by software engineers?
    9·1 answer
  • You're asked to recommend potential data structures to use as the backing for implementing Kruskal's algorithm. Which of the fol
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!