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
2 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]2 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
Which of the constraints listed below would be considered a physical constraint
timurjin [86]
Materials

materials are the only physical thing
8 0
2 years ago
How to make classs constructer java.
ladessa [460]

Answer:

A constructor doesn't have a return type.

The name of the constructor must be the same as the name of the class.

Unlike methods, constructors are not considered to be members of a class.  

A constructor is called when a new instance of an object is created.

Explanation:

4 0
2 years ago
Create a logic array qualifyingIndex with true for any location where the runner is male with a running time less than 8.2. Row
larisa [96]

Rounding Numbers

Say you wanted to round the number 838.274. Depending on which place value you'll round to, the final result will vary. Rounding 838.274:

Rounding to the nearest hundred is 800

Rounding to the nearest ten is 840

Rounding to the nearest one is 838

Rounding to the nearest tenth is 838.3

Rounding to the nearest hundredth is 838.27

5 0
3 years ago
What type of expense generally covers performing and producing elements?
Paraphin [41]

Answer:

You might think expenses are expenses. If the money's going out, it's an expense. But here at Fiscal Fitness, we like to think of your expenses in four distinct ways: fixed, recurring, non-recurring, and whammies (the worst kind of expense, by far).

7 0
2 years ago
Quinn is opening an Excel workbook and receives an information bar and warning that the workbook contains macros. Quinn is promp
Andrew [12]

Answer:

Check where the file originates from, and if it is a trusted source or his own workbook, click Enable Content.

Explanation:

4 0
2 years ago
Read 2 more answers
Other questions:
  • WILL GIVE BRAINLIEST! A rent payment is an example of which type of expense?
    14·2 answers
  • In internet terminology, what is the term, .com, called?
    12·2 answers
  • Structured walk-throughs take place throughout the SDLC and are called _____ reviews, depending on the phase in which they occur
    9·1 answer
  • Help what is a computer made from (computer class question)!!
    9·1 answer
  • The natural language convention used to represent ip addresses is called the:
    15·1 answer
  • In what form do the hexadecimal numbers need to be converted for a computer’s digital circuit to process them?
    10·1 answer
  • Part of metacognition involves making a plan to address <br> .
    9·2 answers
  • Which word or phrase refers to an increasingly common method of computing and storing files?
    15·2 answers
  • Professional communication must be objective,
    8·1 answer
  • During which phase of system development would you acquire any necessary hardware and software?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!